mirror of
https://github.com/vercel/next-learn.git
synced 2026-06-28 23:24:18 +00:00
t
This commit is contained in:
@@ -3,4 +3,4 @@ import NextAuth from 'next-auth';
|
||||
|
||||
const handler = NextAuth(authOptions);
|
||||
|
||||
export { handler as GET, handler as POST, authOptions };
|
||||
export { handler as GET, handler as POST };
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import './global.css';
|
||||
import type { Metadata } from 'next';
|
||||
import { Inter } from 'next/font/google';
|
||||
import Providers from './providers';
|
||||
|
||||
const inter = Inter({ subsets: ['latin'] });
|
||||
|
||||
@@ -17,9 +16,7 @@ export default function RootLayout({
|
||||
}) {
|
||||
return (
|
||||
<html lang="en">
|
||||
<body className={inter.className}>
|
||||
<Providers>{children}</Providers>
|
||||
</body>
|
||||
<body className={inter.className}>{children}</body>
|
||||
</html>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,13 +1,6 @@
|
||||
import LoginForm from '@/app/ui/login-form';
|
||||
import { getServerSession } from 'next-auth/next';
|
||||
import { redirect } from 'next/navigation';
|
||||
import { authOptions } from '@/app/api/auth/[...nextauth]/route';
|
||||
|
||||
export default async function Page() {
|
||||
// Get user session token
|
||||
const session = await getServerSession(authOptions);
|
||||
if (session) redirect('/dashboard');
|
||||
|
||||
return (
|
||||
<main>
|
||||
<LoginForm />
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
export { default } from 'next-auth/middleware';
|
||||
|
||||
export const config = { matcher: ['/(dashboard.*)'] };
|
||||
export const config = { matcher: ['/(dashboard.*)', '/login'] };
|
||||
|
||||
Reference in New Issue
Block a user