diff --git a/dashboard/15-final/app/Providers.tsx b/dashboard/15-final/app/Providers.tsx
new file mode 100644
index 0000000..857fa05
--- /dev/null
+++ b/dashboard/15-final/app/Providers.tsx
@@ -0,0 +1,7 @@
+'use client';
+
+import { SessionProvider } from 'next-auth/react';
+
+export const AuthProvider = ({ children }) => {
+ return {children};
+};
diff --git a/dashboard/15-final/app/api/auth/[...nextauth]/route.ts b/dashboard/15-final/app/api/auth/[...nextauth]/route.ts
index 040cb31..8ba8178 100644
--- a/dashboard/15-final/app/api/auth/[...nextauth]/route.ts
+++ b/dashboard/15-final/app/api/auth/[...nextauth]/route.ts
@@ -1,10 +1,10 @@
-import NextAuth from 'next-auth/next';
+import NextAuth from 'next-auth';
import CredentialsProvider from 'next-auth/providers/credentials';
import bcrypt from 'bcrypt';
import { fetchUser } from '../../../lib/data';
import { User } from '@/app/lib/definitions';
-export const authOptions = {
+const authOptions = {
providers: [
CredentialsProvider({
name: 'credentials',
@@ -18,7 +18,7 @@ export const authOptions = {
try {
const user = await fetchUser(email);
- console.log('user: ', user);
+
if (!user) {
return null;
}
@@ -48,4 +48,4 @@ export const authOptions = {
const handler = NextAuth(authOptions);
-export { handler as GET, handler as POST };
+export { handler as GET, handler as POST, authOptions };
diff --git a/dashboard/15-final/app/layout.tsx b/dashboard/15-final/app/layout.tsx
index 43a3e24..1aca260 100644
--- a/dashboard/15-final/app/layout.tsx
+++ b/dashboard/15-final/app/layout.tsx
@@ -1,6 +1,7 @@
import './global.css';
import type { Metadata } from 'next';
import { Inter } from 'next/font/google';
+import { AuthProvider } from './Providers';
const inter = Inter({ subsets: ['latin'] });
@@ -16,7 +17,9 @@ export default function RootLayout({
}) {
return (
-
{children}
+
+ {children}
+
);
}