Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | import { NextResponse } from 'next/server' import { getUserId } from '@/lib/viewer' import { withAuth } from '@/lib/auth/withAuth' /** * GET /api/identity * * Returns the current viewer's stable database user.id */ export const GET = withAuth(async () => { try { const userId = await getUserId() return NextResponse.json({ userId }) } catch (_error) { return NextResponse.json({ error: 'No valid viewer session found' }, { status: 401 }) } }) |