Skip to content

Commit

Permalink
App: Error handling on login #758
Browse files Browse the repository at this point in the history
  • Loading branch information
lil5 committed Oct 7, 2024
1 parent 7df1f99 commit b48a2c0
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions app/src/pages/Login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export default function Login(props: { isLoggedIn: boolean }) {
inputEmail.current?.blur();
} catch (err: any) {
setSentState(State.error);
toastError(present, err?.statusText || err?.message);
toastError(present, err);
console.error(err);
}
})();
Expand All @@ -102,7 +102,10 @@ export default function Login(props: { isLoggedIn: boolean }) {
function handleVerifyToken() {
if (verifyState === State.loading) return;
let token = inputToken.current?.value || "";
if (!token) return;
if (!token) {
toastError(present, "Passcode required");
return;
}
setVerifyState(State.loading);

if (token === "12345678" && tokenOverride !== "") {
Expand All @@ -117,7 +120,7 @@ export default function Login(props: { isLoggedIn: boolean }) {
modal.current?.dismiss("success");
history.replace("/settings", "select-loop");
} catch (e: any) {
console.error(e);
toastError(present, e);
if (!(e?.status === 401)) connError(e);
setVerifyState(State.error);
}
Expand Down

0 comments on commit b48a2c0

Please sign in to comment.