Newer
Older
import { getServerSession } from 'next-auth/next'
import { NextResponse } from 'next/server'
const session = await getServerSession(authOptions)
if (!session) {
return new NextResponse(JSON.stringify({ error: 'unauthorized' }), { status: 401 })
}
return NextResponse.json({ authenticated: !!session })
}