From 57b35f7aa997d125245dfc1b84337c35f769f89f Mon Sep 17 00:00:00 2001 From: Michael Shihjay Chen Date: Sun, 3 Nov 2024 08:44:16 -0800 Subject: [PATCH] fix login ui --- components/magicLink/login.tsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/components/magicLink/login.tsx b/components/magicLink/login.tsx index 0264b1c8..6a2198b3 100644 --- a/components/magicLink/login.tsx +++ b/components/magicLink/login.tsx @@ -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(null); @@ -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); @@ -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, @@ -386,7 +387,7 @@ export default function Login({ challenge, clinical=false, authonly=false, clien ) : ( New to Trustee? Create your Trustee and Passkey )} - {isError ? ( + {isError || isProcess ? ( ) : (
)}