Skip to content

Commit

Permalink
window focus check
Browse files Browse the repository at this point in the history
  • Loading branch information
shihjay2 committed Oct 5, 2024
1 parent f7f939f commit 487b5e9
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
11 changes: 10 additions & 1 deletion components/magicLink/login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { supported, create, get, parseCreationOptionsFromJSON, parseRequestOptio
import moment from 'moment';
import { useEffect, useState } from 'react';
import objectPath from 'object-path';
import useWindowFocus from 'use-window-focus';

import Accordion from '@mui/material/Accordion';
import AccordionSummary from '@mui/material/AccordionSummary';
Expand Down Expand Up @@ -42,6 +43,7 @@ export default function Login({ challenge, clinical=false, authonly=false, clien
const [email, setEmailValue] = useState("");
const [clientExist, setClientExist] = useState(false);
const [isContinue, setContinue] = useState(false);
const windowFocused = useWindowFocus();

useEffect(() => {
const checkAvailability = async () => {
Expand Down Expand Up @@ -121,7 +123,14 @@ export default function Login({ challenge, clinical=false, authonly=false, clien
console.log('user added');
}
}
console.log('registering passkey now...')
console.log('registering passkey now...');
let window_check = false;
while (!window_check) {
await sleep(2);
if (windowFocused) {
window_check = true;
}
}
setProgress('Registering PassKey...');
const cco = parseCreationOptionsFromJSON({
publicKey: {
Expand Down
13 changes: 13 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
"sharp": "^0.32.5",
"sleep-promise": "^9.1.0",
"sort-array": "^4.1.5",
"use-window-focus": "^1.4.3",
"uuid": "^10.0.0"
},
"devDependencies": {
Expand Down

0 comments on commit 487b5e9

Please sign in to comment.