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