From 2f7bc4fe8e38b604c96f2deaadc50d5299e3aa69 Mon Sep 17 00:00:00 2001 From: Paul Bailey Date: Tue, 2 Dec 2025 14:01:05 +0000 Subject: [PATCH] Fix NextAuth v4 imports and exports --- app/api/lists/[id]/last-updated/route.ts | 5 +++-- pages/api/auth/[...nextauth].ts | 6 ++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/app/api/lists/[id]/last-updated/route.ts b/app/api/lists/[id]/last-updated/route.ts index 8786b1f..3881208 100644 --- a/app/api/lists/[id]/last-updated/route.ts +++ b/app/api/lists/[id]/last-updated/route.ts @@ -1,6 +1,7 @@ import { NextRequest, NextResponse } from 'next/server' import { prisma } from '@/lib/db' -import { auth } from '@/auth' +import { getServerSession } from 'next-auth' +import { authOptions } from '@/pages/api/auth/[...nextauth]' export const dynamic = 'force-dynamic' export const revalidate = 0 @@ -10,7 +11,7 @@ export async function GET( { params }: { params: { id: string } } ) { try { - const session = await auth() + const session = await getServerSession(authOptions) if (!session?.user?.id) { return NextResponse.json( { error: 'Unauthorized' }, diff --git a/pages/api/auth/[...nextauth].ts b/pages/api/auth/[...nextauth].ts index 35e2330..95da587 100644 --- a/pages/api/auth/[...nextauth].ts +++ b/pages/api/auth/[...nextauth].ts @@ -9,7 +9,7 @@ const loginSchema = z.object({ password: z.string().min(1), }) -export default NextAuth({ +export const authOptions = { providers: [ CredentialsProvider({ name: "credentials", @@ -49,4 +49,6 @@ export default NextAuth({ return session }, }, -}) \ No newline at end of file +} + +export default NextAuth(authOptions) \ No newline at end of file