@@ -5,107 +5,100 @@ import Link from "next/link";
5
5
import toast from "react-hot-toast" ;
6
6
7
7
export default function SignInScreen ( ) {
8
- const handleSubmit = submitHandler ( async ( formData : FormData ) => {
9
- const email = formData . get ( "email" ) ?. toString ( ) || "" ;
10
- const password = formData . get ( "password" ) ?. toString ( ) || "" ;
8
+ const handleSubmit = submitHandler ( async ( formData : FormData ) => {
9
+ const email = formData . get ( "email" ) ?. toString ( ) || "" ;
10
+ const password = formData . get ( "password" ) ?. toString ( ) || "" ;
11
11
12
- try {
13
- const resp = await signIn ( "credentials" , {
14
- email,
15
- password,
16
- redirect : false ,
17
- } ) ;
12
+ try {
13
+ const resp = await signIn ( "credentials" , {
14
+ email,
15
+ password,
16
+ redirect : false ,
17
+ } ) ;
18
18
19
- if ( resp ?. code === INVALID_CREDENTIALS_ERR ) {
20
- return toast . error ( "Invalid credentials" ) ;
21
- }
22
- } catch ( e ) {
23
- toast . error ( "Unknown error" ) ;
24
- console . error ( e ) ;
25
- }
26
- } ) ;
19
+ if ( resp ?. code === INVALID_CREDENTIALS_ERR ) {
20
+ return toast . error ( "Invalid credentials" ) ;
21
+ }
22
+ } catch ( e ) {
23
+ toast . error ( "Unknown error" ) ;
24
+ console . error ( e ) ;
25
+ }
26
+ } ) ;
27
27
28
- return (
29
- < main className = "bg-gradient-to-tr from-[#4AA6EB] to-[#F0424E] w-screen h-screen flex flex-col justify-center items-center" >
30
- < div className = "bg-white py-6 px-6 rounded-xl" >
31
- < div className = "flex flex-col justify-center items-center" >
32
- { /* eslint-disable-next-line @next/next/no-img-element */ }
33
- < img
34
- src = "/logo.svg"
35
- alt = "Hope for Haiti Logo"
36
- className = "mb-4"
37
- />
38
- < h1 className = "mb-1 text-xl font-semibold" > Log In</ h1 >
39
- < h2 className = "mb-4 text-gray-800 opacity-70 font-light text-sm" >
40
- Please enter your credentials.
41
- </ h2 >
42
- </ div >
43
- < form onSubmit = { handleSubmit } className = "w-80" >
44
- < div className = "mb-4" >
45
- < label
46
- className = "block text-gray-800 text-sm mb-2 font-light"
47
- htmlFor = "email"
48
- >
49
- Email
50
- </ label >
51
- < input
52
- className = "bg-zinc-50 appearance-none border-gray-200 rounded w-full py-2 px-3 text-gray-700 leading-tight font-light text-sm"
53
- id = "email"
54
- name = "email"
55
- type = "email"
56
- placeholder = "Email"
57
- required
58
- />
59
- </ div >
28
+ return (
29
+ < main className = "bg-gradient-to-tr from-[#4AA6EB] to-[#F0424E] w-screen h-screen flex flex-col justify-center items-center" >
30
+ < div className = "bg-white py-6 px-6 rounded-xl" >
31
+ < div className = "flex flex-col justify-center items-center" >
32
+ { /* eslint-disable-next-line @next/next/no-img-element */ }
33
+ < img src = "/logo.svg" alt = "Hope for Haiti Logo" className = "mb-4" />
34
+ < h1 className = "mb-1 text-xl font-semibold" > Log In</ h1 >
35
+ < h2 className = "mb-4 text-gray-800 opacity-70 font-light text-sm" >
36
+ Please enter your credentials.
37
+ </ h2 >
38
+ </ div >
39
+ < form onSubmit = { handleSubmit } className = "w-80" >
40
+ < div className = "mb-4" >
41
+ < label
42
+ className = "block text-gray-800 text-sm mb-2 font-light"
43
+ htmlFor = "email"
44
+ >
45
+ Email
46
+ </ label >
47
+ < input
48
+ className = "bg-zinc-50 appearance-none border-gray-200 rounded w-full py-2 px-3 text-gray-700 leading-tight font-light text-sm"
49
+ id = "email"
50
+ name = "email"
51
+ type = "email"
52
+ placeholder = "Email"
53
+ required
54
+ />
55
+ </ div >
60
56
61
- < div className = "mb-2" >
62
- < label
63
- className = "block text-gray-800 text-sm mb-2 font-light"
64
- htmlFor = "password"
65
- >
66
- Password
67
- </ label >
68
- < input
69
- className = "bg-zinc-50 appearance-none border-gray-200 rounded w-full py-2 px-3 text-gray-700 leading-tight font-light text-sm"
70
- id = "password"
71
- name = "password"
72
- type = "password"
73
- placeholder = "Password"
74
- required
75
- />
76
- </ div >
57
+ < div className = "mb-2" >
58
+ < label
59
+ className = "block text-gray-800 text-sm mb-2 font-light"
60
+ htmlFor = "password"
61
+ >
62
+ Password
63
+ </ label >
64
+ < input
65
+ className = "bg-zinc-50 appearance-none border-gray-200 rounded w-full py-2 px-3 text-gray-700 leading-tight font-light text-sm"
66
+ id = "password"
67
+ name = "password"
68
+ type = "password"
69
+ placeholder = "Password"
70
+ required
71
+ />
72
+ </ div >
77
73
78
- < div className = "flex justify-between align-middle" >
79
- < div >
80
- < input
81
- type = "checkbox"
82
- className = "bg-zinc-50 border-gray-200 rounded focus:ring-0"
83
- />
84
- < label
85
- htmlFor = "remember"
86
- className = "text-gray-800 text-xs ml-2 font-light"
87
- >
88
- Remember me
89
- </ label >
90
- </ div >
91
- < div >
92
- < Link
93
- href = { "/sign_in" }
94
- className = "text-red-500 text-xs"
95
- >
96
- Forgot Password
97
- </ Link >
98
- </ div >
99
- </ div >
100
-
101
- < button
102
- className = "w-full bg-red-500 hover:bg-red-700 text-white py-1 px-4 mt-7 rounded focus:outline-none focus:shadow-outline"
103
- type = "submit"
104
- >
105
- Login
106
- </ button >
107
- </ form >
74
+ < div className = "flex justify-between align-middle" >
75
+ < div >
76
+ < input
77
+ type = "checkbox"
78
+ className = "bg-zinc-50 border-gray-200 rounded focus:ring-0"
79
+ />
80
+ < label
81
+ htmlFor = "remember"
82
+ className = "text-gray-800 text-xs ml-2 font-light"
83
+ >
84
+ Remember me
85
+ </ label >
86
+ </ div >
87
+ < div >
88
+ < Link href = { "/sign_in" } className = "text-red-500 text-xs" >
89
+ Forgot Password
90
+ </ Link >
108
91
</ div >
109
- </ main >
110
- ) ;
92
+ </ div >
93
+
94
+ < button
95
+ className = "w-full bg-red-500 hover:bg-red-700 text-white py-1 px-4 mt-7 rounded focus:outline-none focus:shadow-outline"
96
+ type = "submit"
97
+ >
98
+ Login
99
+ </ button >
100
+ </ form >
101
+ </ div >
102
+ </ main >
103
+ ) ;
111
104
}
0 commit comments