Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion dashboard/final-example/app/login/page.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import AcmeLogo from '@/app/ui/acme-logo';
import LoginForm from '@/app/ui/login-form';
import { Suspense } from 'react';

export default function LoginPage() {
return (
Expand All @@ -10,7 +11,9 @@ export default function LoginPage() {
<AcmeLogo />
</div>
</div>
<LoginForm />
<Suspense>
<LoginForm />
</Suspense>
</div>
</main>
);
Expand Down
2 changes: 1 addition & 1 deletion dashboard/final-example/app/ui/dashboard/sidenav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export default function SideNav() {
<form
action={async () => {
'use server';
await signOut();
await signOut({ redirectTo: '/' });
}}
>
<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">
Expand Down
8 changes: 6 additions & 2 deletions dashboard/final-example/app/ui/login-form.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
'use client';

import { authenticate } from '@/app/lib/actions';
import { lusitana } from '@/app/ui/fonts';
import {
AtSymbolIcon,
KeyIcon,
ExclamationCircleIcon,
} from '@heroicons/react/24/outline';
import { ArrowRightIcon } from '@heroicons/react/20/solid';
import { Button } from './button';
import { Button } from '@/app/ui/button';
import { useActionState } from 'react';
import { authenticate } from '@/app/lib/actions';
import { useSearchParams } from 'next/navigation';

export default function LoginForm() {
const searchParams = useSearchParams();
const callbackUrl = searchParams.get('callbackUrl') || '/dashboard';
const [errorMessage, formAction, isPending] = useActionState(
authenticate,
undefined,
Expand Down Expand Up @@ -64,6 +67,7 @@ export default function LoginForm() {
</div>
</div>
</div>
<input type="hidden" name="redirectTo" value={callbackUrl} />
<Button className="mt-4 w-full" aria-disabled={isPending}>
Log in <ArrowRightIcon className="ml-auto h-5 w-5 text-gray-50" />
</Button>
Expand Down
20 changes: 10 additions & 10 deletions dashboard/final-example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,25 @@
},
"dependencies": {
"@heroicons/react": "^2.2.0",
"@tailwindcss/forms": "^0.5.9",
"@tailwindcss/forms": "^0.5.10",
"@vercel/postgres": "^0.10.0",
"autoprefixer": "10.4.20",
"bcrypt": "^5.1.1",
"clsx": "^2.1.1",
"next": "latest",
"next-auth": "5.0.0-beta.19",
"postcss": "8.4.49",
"next": "^15.1.5",
"next-auth": "5.0.0-beta.25",
"postcss": "8.5.1",
"react": "19.0.0",
"react-dom": "19.0.0",
"tailwindcss": "3.4.16",
"typescript": "5.7.2",
"tailwindcss": "3.4.17",
"typescript": "5.7.3",
"use-debounce": "^10.0.4",
"zod": "^3.23.8"
"zod": "^3.24.1"
},
"devDependencies": {
"@types/bcrypt": "^5.0.2",
"@types/node": "22.10.1",
"@types/react": "19.0.0",
"@types/react-dom": "19.0.0"
"@types/node": "22.10.7",
"@types/react": "19.0.7",
"@types/react-dom": "19.0.3"
}
}
Loading
Loading