Skip to content

Commit 0e43f92

Browse files
committed
fix timer
1 parent 1a888ea commit 0e43f92

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

components/magicLink/login.tsx

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -67,17 +67,20 @@ export default function Login({ challenge, clinical=false, authonly=false, clien
6767
let check = false;
6868
let proceed = false;
6969
let timer = 0;
70-
while (!check || timer < 50) {
71-
await sleep(5);
72-
const nonce_check = await fetch("/api/auth/check",
73-
{ method: "POST", headers: {"Content-Type": "application/json"}, body: JSON.stringify({nonce: nonce}) })
74-
.then((res) => res.json());
75-
if (nonce_check.success) {
70+
while (!check) {
71+
if (timer < 200) {
72+
await sleep(5);
73+
const nonce_check = await fetch("/api/auth/check",
74+
{ method: "POST", headers: {"Content-Type": "application/json"}, body: JSON.stringify({nonce: nonce}) })
75+
.then((res) => res.json());
76+
if (nonce_check.success) {
77+
check = true;
78+
proceed = true;
79+
}
80+
timer++;
81+
} else {
7682
check = true;
77-
proceed = true;
7883
}
79-
timer++;
80-
console.log(timer)
8184
}
8285
if (proceed) {
8386
await fetch("/api/magicLink/login",

0 commit comments

Comments
 (0)