Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

style: showing user sign-in progress on sign-in with code #311

Merged
merged 4 commits into from
Feb 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions apps/app/components/account/email-code-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
5 changes: 3 additions & 2 deletions apps/app/pages/signin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down