Skip to content

Commit 57b35f7

Browse files
committed
fix login ui
1 parent af45edd commit 57b35f7

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

components/magicLink/login.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ export default function Login({ challenge, clinical=false, authonly=false, clien
3434
const router = useRouter();
3535
const [error, setError] = useState("");
3636
const [isError, setIsError] = useState(false);
37+
const [isProcess, setIsProcess] = useState(false);
3738
const [isChecking, setIsChecking] = useState(false);
3839
const [isTimeout, setIsTimeout] = useState(false);
3940
const [isAvailable, setIsAvailable] = useState<boolean | null>(null);
@@ -73,7 +74,7 @@ export default function Login({ challenge, clinical=false, authonly=false, clien
7374
// Check if user has an account
7475
localStorage.setItem('email', email);
7576
setIsChecking(true);
76-
setIsError(true);
77+
setIsProcess(true);
7778
const isRegistered = await fetch("/api/couchdb/patients/" + email,
7879
{ method: "GET", headers: {"Content-Type": "application/json"} })
7980
.then((res) => res.json()).then((json) => json._id);
@@ -227,7 +228,7 @@ export default function Login({ challenge, clinical=false, authonly=false, clien
227228
if (email !== '') {
228229
if (validate(email)) {
229230
setProgress('Authentication using PassKey...');
230-
setIsError(true);
231+
setIsProcess(true);
231232
const cro = parseRequestOptionsFromJSON({
232233
publicKey: {
233234
challenge,
@@ -386,7 +387,7 @@ export default function Login({ challenge, clinical=false, authonly=false, clien
386387
) : (
387388
<Grid style={{ textAlign: "center" }}>New to Trustee? <Link component="button" onClick={createPassKey}>Create your Trustee and Passkey</Link></Grid>
388389
)}
389-
{isError ? (
390+
{isError || isProcess ? (
390391
<Button variant="contained" onClick={replay} startIcon={<div><ReplayIcon/></div>}>Start Over</Button>
391392
) : (<div></div>)}
392393
</Stack>

0 commit comments

Comments
 (0)