chore: Update auth files for NextAuth v5 compatibility
Breaking changes for NextAuth v5: - Updated route.ts to use NextAuthConfig and new export pattern - Changed getServerSession import to use auth from config - Updated types and session handling for NextAuth v5 - Maintained backward compatibility with existing auth flow
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
import { getServerSession } from 'next-auth'
|
||||
import { auth } from '@/app/api/auth/[...nextauth]/route'
|
||||
import { redirect } from 'next/navigation'
|
||||
|
||||
export async function requireAuth() {
|
||||
const session = await getServerSession()
|
||||
const session = await auth()
|
||||
|
||||
if (!session || !session.user) {
|
||||
redirect('/auth/signin')
|
||||
|
||||
Reference in New Issue
Block a user