From 5cbb3ecd4df97f3d6f8299e171a36a5ab9f865f0 Mon Sep 17 00:00:00 2001 From: Dakshesh Jain <65905942+dakshesh14@users.noreply.github.com> Date: Tue, 21 Feb 2023 19:14:12 +0530 Subject: [PATCH] style: showing user sign-in progress on sign-in with code (#311) * style: not showing pointer & theme color on resend code button disabled * style: showing user sign-in progress on sign-in with code * style: showing error from server on sign-in with code fail --- apps/app/components/account/email-code-form.tsx | 3 +-- apps/app/pages/signin.tsx | 5 +++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/app/components/account/email-code-form.tsx b/apps/app/components/account/email-code-form.tsx index e150a639f..db201041c 100644 --- a/apps/app/components/account/email-code-form.tsx +++ b/apps/app/components/account/email-code-form.tsx @@ -70,11 +70,10 @@ export const EmailCodeForm = ({ onSuccess }: any) => { onSuccess(response); }) .catch((error) => { - console.log(error); setToastAlert({ title: "Oops!", type: "error", - message: "Enter the correct code to sign in", + message: error?.response?.data?.error ?? "Enter the correct code to sign in", }); setError("token" as keyof EmailCodeFormValues, { type: "manual", diff --git a/apps/app/pages/signin.tsx b/apps/app/pages/signin.tsx index 968a47d8e..fff701679 100644 --- a/apps/app/pages/signin.tsx +++ b/apps/app/pages/signin.tsx @@ -35,10 +35,11 @@ const SignInPage: NextPage = () => { const { setToastAlert } = useToast(); const onSignInSuccess = useCallback(async () => { + setLoading(true); await mutateUser(); const nextLocation = router.asPath.split("?next=")[1]; - if (nextLocation) router.push(nextLocation as string); - else router.push("/"); + if (nextLocation) await router.push(nextLocation as string); + else await router.push("/"); }, [mutateUser, router]); const handleGoogleSignIn = ({ clientId, credential }: any) => {