Skip to content

Commit

Permalink
adds a timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
arch1995 committed Aug 6, 2024
1 parent 91fa9c0 commit 1ab23ad
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions example/react-app/src/services/playground.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -184,14 +184,7 @@ export function Playground({ children }: IPlaygroundProps) {
);

const getAllPasskeys = async (activePasskeyPlugin: PasskeysPlugin) => {
const res = (await activePasskeyPlugin?.listAllPasskeys()) as unknown as {
id: number;
provider_name: string;
browser: string;
browser_version: string;
os: string;
updated_at: string;
}[];
const res = await activePasskeyPlugin?.listAllPasskeys();
setHasPasskeys(res.length > 0);
setPasskeys(
res.map((passkey) => {
Expand Down Expand Up @@ -242,7 +235,9 @@ export function Playground({ children }: IPlaygroundProps) {
username: `google|${sfaAuthUserInfo?.email || sfaAuthUserInfo?.name} - ${new Date().toLocaleDateString("en-GB")}`,
});
if (res) {
await getAllPasskeys(plugin);
setTimeout(async () => {
await getAllPasskeys(plugin);
}, 500);
uiConsole("Passkey saved successfully");
}
} catch (error: unknown) {
Expand All @@ -265,7 +260,9 @@ export function Playground({ children }: IPlaygroundProps) {
try {
const success = await plugin.unregisterPasskey(id);
if (success) {
await getAllPasskeys(plugin);
setTimeout(async () => {
await getAllPasskeys(plugin);
}, 500);
uiConsole("Passkey deleted successfully");
}
} catch (error) {
Expand Down

0 comments on commit 1ab23ad

Please sign in to comment.