File tree Expand file tree Collapse file tree 7 files changed +421
-408
lines changed Expand file tree Collapse file tree 7 files changed +421
-408
lines changed Original file line number Diff line number Diff line change 11import AcmeLogo from '@/app/ui/acme-logo' ;
22import LoginForm from '@/app/ui/login-form' ;
3+ import { Suspense } from 'react' ;
34
45export default function LoginPage ( ) {
56 return (
@@ -10,7 +11,9 @@ export default function LoginPage() {
1011 < AcmeLogo />
1112 </ div >
1213 </ div >
13- < LoginForm />
14+ < Suspense >
15+ < LoginForm />
16+ </ Suspense >
1417 </ div >
1518 </ main >
1619 ) ;
Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ export default function SideNav() {
2121 < form
2222 action = { async ( ) => {
2323 'use server' ;
24- await signOut ( ) ;
24+ await signOut ( { redirectTo : '/' } ) ;
2525 } }
2626 >
2727 < 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 11'use client' ;
22
3- import { authenticate } from '@/app/lib/actions' ;
43import { lusitana } from '@/app/ui/fonts' ;
54import {
65 AtSymbolIcon ,
76 KeyIcon ,
87 ExclamationCircleIcon ,
98} from '@heroicons/react/24/outline' ;
109import { ArrowRightIcon } from '@heroicons/react/20/solid' ;
11- import { Button } from '. /button' ;
10+ import { Button } from '@/app/ui /button' ;
1211import { useActionState } from 'react' ;
12+ import { authenticate } from '@/app/lib/actions' ;
13+ import { useSearchParams } from 'next/navigation' ;
1314
1415export default function LoginForm ( ) {
16+ const searchParams = useSearchParams ( ) ;
17+ const callbackUrl = searchParams . get ( 'callbackUrl' ) || '/dashboard' ;
1518 const [ errorMessage , formAction , isPending ] = useActionState (
1619 authenticate ,
1720 undefined ,
@@ -64,6 +67,7 @@ export default function LoginForm() {
6467 </ div >
6568 </ div >
6669 </ div >
70+ < input type = "hidden" name = "redirectTo" value = { callbackUrl } />
6771 < Button className = "mt-4 w-full" aria-disabled = { isPending } >
6872 Log in < ArrowRightIcon className = "ml-auto h-5 w-5 text-gray-50" />
6973 </ Button >
Original file line number Diff line number Diff line change 77 },
88 "dependencies" : {
99 "@heroicons/react" : " ^2.2.0" ,
10- "@tailwindcss/forms" : " ^0.5.9 " ,
10+ "@tailwindcss/forms" : " ^0.5.10 " ,
1111 "@vercel/postgres" : " ^0.10.0" ,
1212 "autoprefixer" : " 10.4.20" ,
1313 "bcrypt" : " ^5.1.1" ,
1414 "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 " ,
1818 "react" : " 19.0.0" ,
1919 "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 " ,
2222 "use-debounce" : " ^10.0.4" ,
23- "zod" : " ^3.23.8 "
23+ "zod" : " ^3.24.1 "
2424 },
2525 "devDependencies" : {
2626 "@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 "
3030 }
3131}
You can’t perform that action at this time.
0 commit comments