This commit is contained in:
StephDietz
2023-09-21 15:49:32 -05:00
parent fb8a985655
commit 34815dc393
4 changed files with 3 additions and 13 deletions

View File

@@ -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 };

View File

@@ -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>
);
}

View File

@@ -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 />

View File

@@ -1,3 +1,3 @@
export { default } from 'next-auth/middleware';
export const config = { matcher: ['/(dashboard.*)'] };
export const config = { matcher: ['/(dashboard.*)', '/login'] };