File tree 7 files changed +421
-408
lines changed
7 files changed +421
-408
lines changed Original file line number Diff line number Diff line change 1
1
import AcmeLogo from '@/app/ui/acme-logo' ;
2
2
import LoginForm from '@/app/ui/login-form' ;
3
+ import { Suspense } from 'react' ;
3
4
4
5
export default function LoginPage ( ) {
5
6
return (
@@ -10,7 +11,9 @@ export default function LoginPage() {
10
11
< AcmeLogo />
11
12
</ div >
12
13
</ div >
13
- < LoginForm />
14
+ < Suspense >
15
+ < LoginForm />
16
+ </ Suspense >
14
17
</ div >
15
18
</ main >
16
19
) ;
Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ export default function SideNav() {
21
21
< form
22
22
action = { async ( ) => {
23
23
'use server' ;
24
- await signOut ( ) ;
24
+ await signOut ( { redirectTo : '/' } ) ;
25
25
} }
26
26
>
27
27
< button className = "flex h-[48px] w-full grow items-center justify-center gap-2 rounded-md bg-gray-50 p-3 text-sm font-medium hover:bg-sky-100 hover:text-blue-600 md:flex-none md:justify-start md:p-2 md:px-3" >
Original file line number Diff line number Diff line change 1
1
'use client' ;
2
2
3
- import { authenticate } from '@/app/lib/actions' ;
4
3
import { lusitana } from '@/app/ui/fonts' ;
5
4
import {
6
5
AtSymbolIcon ,
7
6
KeyIcon ,
8
7
ExclamationCircleIcon ,
9
8
} from '@heroicons/react/24/outline' ;
10
9
import { ArrowRightIcon } from '@heroicons/react/20/solid' ;
11
- import { Button } from '. /button' ;
10
+ import { Button } from '@/app/ui /button' ;
12
11
import { useActionState } from 'react' ;
12
+ import { authenticate } from '@/app/lib/actions' ;
13
+ import { useSearchParams } from 'next/navigation' ;
13
14
14
15
export default function LoginForm ( ) {
16
+ const searchParams = useSearchParams ( ) ;
17
+ const callbackUrl = searchParams . get ( 'callbackUrl' ) || '/dashboard' ;
15
18
const [ errorMessage , formAction , isPending ] = useActionState (
16
19
authenticate ,
17
20
undefined ,
@@ -64,6 +67,7 @@ export default function LoginForm() {
64
67
</ div >
65
68
</ div >
66
69
</ div >
70
+ < input type = "hidden" name = "redirectTo" value = { callbackUrl } />
67
71
< Button className = "mt-4 w-full" aria-disabled = { isPending } >
68
72
Log in < ArrowRightIcon className = "ml-auto h-5 w-5 text-gray-50" />
69
73
</ Button >
Original file line number Diff line number Diff line change 7
7
},
8
8
"dependencies" : {
9
9
"@heroicons/react" : " ^2.2.0" ,
10
- "@tailwindcss/forms" : " ^0.5.9 " ,
10
+ "@tailwindcss/forms" : " ^0.5.10 " ,
11
11
"@vercel/postgres" : " ^0.10.0" ,
12
12
"autoprefixer" : " 10.4.20" ,
13
13
"bcrypt" : " ^5.1.1" ,
14
14
"clsx" : " ^2.1.1" ,
15
- "next" : " latest " ,
16
- "next-auth" : " 5.0.0-beta.19 " ,
17
- "postcss" : " 8.4.49 " ,
15
+ "next" : " ^15.1.5 " ,
16
+ "next-auth" : " 5.0.0-beta.25 " ,
17
+ "postcss" : " 8.5.1 " ,
18
18
"react" : " 19.0.0" ,
19
19
"react-dom" : " 19.0.0" ,
20
- "tailwindcss" : " 3.4.16 " ,
21
- "typescript" : " 5.7.2 " ,
20
+ "tailwindcss" : " 3.4.17 " ,
21
+ "typescript" : " 5.7.3 " ,
22
22
"use-debounce" : " ^10.0.4" ,
23
- "zod" : " ^3.23.8 "
23
+ "zod" : " ^3.24.1 "
24
24
},
25
25
"devDependencies" : {
26
26
"@types/bcrypt" : " ^5.0.2" ,
27
- "@types/node" : " 22.10.1 " ,
28
- "@types/react" : " 19.0.0 " ,
29
- "@types/react-dom" : " 19.0.0 "
27
+ "@types/node" : " 22.10.7 " ,
28
+ "@types/react" : " 19.0.7 " ,
29
+ "@types/react-dom" : " 19.0.3 "
30
30
}
31
31
}
You can’t perform that action at this time.
0 commit comments