diff --git a/dashboard/15-final/.env b/dashboard/15-final/.env index c26b5a8..3f87000 100644 --- a/dashboard/15-final/.env +++ b/dashboard/15-final/.env @@ -1,6 +1,4 @@ -GITHUB_SECRET_ID="5f7808e2598546bc7cd9f955853622ac1ca8bb9a" -GITHUB_CLIENT_ID="28f99c4bf5597685d9da" -NEXTAUTH_URL="http://localhost:3000" +GITHUB_SECRET_ID=NEXTAUTH_URL="http://localhost:3000" NEXTAUTH_SECRET=7XMu1K3gXGmKaVKW02Lo4Z8Vi2kkcFfpQUmt2yHMgFg= POSTGRES_URL="postgres://default:IQA2FonHJi9d@ep-square-union-29037633-pooler.us-east-1.postgres.vercel-storage.com:5432/verceldb" POSTGRES_PRISMA_URL="postgres://default:IQA2FonHJi9d@ep-square-union-29037633-pooler.us-east-1.postgres.vercel-storage.com:5432/verceldb?pgbouncer=true&connect_timeout=15" diff --git a/dashboard/15-final/app/api/auth/[...nextauth]/route.ts b/dashboard/15-final/app/api/auth/[...nextauth]/route.ts index 8ba8178..82d8360 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'; +import NextAuth, { NextAuthOptions } 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'; -const authOptions = { +const authOptions: NextAuthOptions = { providers: [ CredentialsProvider({ name: 'credentials', @@ -42,7 +42,7 @@ const authOptions = { }, secret: process.env.NEXTAUTH_SECRET, pages: { - signIn: '/', + signIn: '/login', }, }; diff --git a/dashboard/15-final/app/layout.tsx b/dashboard/15-final/app/layout.tsx index 43a3e24..b4181a1 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} + ); } 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/middleware.ts b/dashboard/15-final/middleware.ts index ac9dee5..44300eb 100644 --- a/dashboard/15-final/middleware.ts +++ b/dashboard/15-final/middleware.ts @@ -1,3 +1,3 @@ export { default } from 'next-auth/middleware'; -export const config = { matcher: ['/dashboard'] }; +export const config = { matcher: ['/(dashboard.*)'] };