Skip to content

Commit 5e66c62

Browse files
added apt. toast message (#562)
1 parent f638d1c commit 5e66c62

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/components/auth/signin.tsx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,21 @@ export const Signin = () => {
3939
try {
4040
const response = await signIn('signin', { ...data, redirect: false });
4141
if (!response?.ok) {
42+
const errorMessage =
43+
response?.error?.includes('User') && response?.error?.includes('does not exist')
44+
? 'User does not exist'
45+
: response?.error || 'Internal server error';
46+
4247
return toast({
43-
title: response?.error || 'Internal server error',
48+
title: errorMessage,
4449
variant: 'destructive',
4550
});
4651
}
4752
toast({
4853
title: 'Login successful! Welcome back!',
4954
variant: 'success',
5055
});
51-
// const redirect = searchParams.get('next') || APP_PATHS.HOME;
56+
5257
const searchParams = new URLSearchParams(window.location.search);
5358
const redirect = searchParams.get('next') || APP_PATHS.HOME;
5459
router.push(redirect);
@@ -60,7 +65,7 @@ export const Signin = () => {
6065
});
6166
}
6267
}
63-
68+
6469
return (
6570
<div className="">
6671
<Form {...form}>

0 commit comments

Comments
 (0)