TypeScript 61.9%
HTML 37.2%
SQL 0.7%
1import { NextResponse } from 'next/server';2import { getCurrentUser } from '@/lib/auth/session';3import { unreadCount } from '@/lib/account/queries';45export const dynamic = 'force-dynamic';67/** GET /api/auth/session — lightweight identity for client components (header user menu). */8export async function GET() {9 const u = await getCurrentUser();10 if (!u) return NextResponse.json({ user: null }, { headers: { 'cache-control': 'private, no-store' } });11 const unread = await unreadCount(u.id);12 return NextResponse.json({ user: { id: u.id, email: u.email, name: u.name, handle: u.handle, avatarUrl: u.avatarUrl, displayCurrency: u.displayCurrency, role: u.role }, unread }, { headers: { 'cache-control': 'private, no-store' } });13}14