File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -39,16 +39,21 @@ export const Signin = () => {
39
39
try {
40
40
const response = await signIn ( 'signin' , { ...data , redirect : false } ) ;
41
41
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
+
42
47
return toast ( {
43
- title : response ?. error || 'Internal server error' ,
48
+ title : errorMessage ,
44
49
variant : 'destructive' ,
45
50
} ) ;
46
51
}
47
52
toast ( {
48
53
title : 'Login successful! Welcome back!' ,
49
54
variant : 'success' ,
50
55
} ) ;
51
- // const redirect = searchParams.get('next') || APP_PATHS.HOME;
56
+
52
57
const searchParams = new URLSearchParams ( window . location . search ) ;
53
58
const redirect = searchParams . get ( 'next' ) || APP_PATHS . HOME ;
54
59
router . push ( redirect ) ;
@@ -60,7 +65,7 @@ export const Signin = () => {
60
65
} ) ;
61
66
}
62
67
}
63
-
68
+
64
69
return (
65
70
< div className = "" >
66
71
< Form { ...form } >
You can’t perform that action at this time.
0 commit comments