Skip to content

Commit

Permalink
fix login ui
Browse files Browse the repository at this point in the history
  • Loading branch information
shihjay2 committed Nov 3, 2024
1 parent af45edd commit 57b35f7
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions components/magicLink/login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export default function Login({ challenge, clinical=false, authonly=false, clien
const router = useRouter();
const [error, setError] = useState("");
const [isError, setIsError] = useState(false);
const [isProcess, setIsProcess] = useState(false);
const [isChecking, setIsChecking] = useState(false);
const [isTimeout, setIsTimeout] = useState(false);
const [isAvailable, setIsAvailable] = useState<boolean | null>(null);
Expand Down Expand Up @@ -73,7 +74,7 @@ export default function Login({ challenge, clinical=false, authonly=false, clien
// Check if user has an account
localStorage.setItem('email', email);
setIsChecking(true);
setIsError(true);
setIsProcess(true);
const isRegistered = await fetch("/api/couchdb/patients/" + email,
{ method: "GET", headers: {"Content-Type": "application/json"} })
.then((res) => res.json()).then((json) => json._id);
Expand Down Expand Up @@ -227,7 +228,7 @@ export default function Login({ challenge, clinical=false, authonly=false, clien
if (email !== '') {
if (validate(email)) {
setProgress('Authentication using PassKey...');
setIsError(true);
setIsProcess(true);
const cro = parseRequestOptionsFromJSON({
publicKey: {
challenge,
Expand Down Expand Up @@ -386,7 +387,7 @@ export default function Login({ challenge, clinical=false, authonly=false, clien
) : (
<Grid style={{ textAlign: "center" }}>New to Trustee? <Link component="button" onClick={createPassKey}>Create your Trustee and Passkey</Link></Grid>
)}
{isError ? (
{isError || isProcess ? (
<Button variant="contained" onClick={replay} startIcon={<div><ReplayIcon/></div>}>Start Over</Button>
) : (<div></div>)}
</Stack>
Expand Down

0 comments on commit 57b35f7

Please sign in to comment.