Skip to content

Commit

Permalink
fix page check
Browse files Browse the repository at this point in the history
  • Loading branch information
shihjay2 committed Oct 5, 2024
1 parent 44b16de commit 8d6a887
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 18 deletions.
7 changes: 3 additions & 4 deletions components/magicLink/login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +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 { usePageVisibility } from 'react-page-visibility';

import Accordion from '@mui/material/Accordion';
import AccordionSummary from '@mui/material/AccordionSummary';
Expand Down Expand Up @@ -43,7 +43,6 @@ 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 @@ -123,12 +122,12 @@ export default function Login({ challenge, clinical=false, authonly=false, clien
console.log('user added');
}
}
console.log(windowFocused);
console.log('registering passkey now...');
let window_check = false;
while (!window_check) {
await sleep(2);
if (windowFocused) {
const isVisible = usePageVisibility();
if (isVisible) {
window_check = true;
}
}
Expand Down
40 changes: 27 additions & 13 deletions package-lock.json

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

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@
"react": "^18.2.0",
"react-datepicker": "^4.14.1",
"react-dom": "^18.2.0",
"react-page-visibility": "^7.0.0",
"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 All @@ -62,6 +62,7 @@
"@types/react": "^18.2.14",
"@types/react-datepicker": "^4.11.2",
"@types/react-dom": "^18.2.6",
"@types/react-page-visibility": "^6.4.4",
"@types/sort-array": "^4.1.0",
"@types/uuid": "^9.0.2",
"autoprefixer": "^10.4.14",
Expand Down

0 comments on commit 8d6a887

Please sign in to comment.