项目文件夹

文件
wehub-resource-sync 221778fa98
rowboat / apps/x Vitest suites (push) Has been cancelled
rowboat / apps/x Electron package smoke test (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 13:33:34 +08:00

20 行
539 B
TypeScript

import { NextRequest, NextResponse } from 'next/server';
import { authCheck } from '@/app/actions/auth.actions';
import { USE_AUTH } from '@/app/lib/feature_flags';
export async function GET(_req: NextRequest) {
try {
let user;
if (USE_AUTH) {
user = await authCheck();
} else {
user = { id: 'guest_user' } as any;
}
return NextResponse.json({ id: user.id });
} catch (error) {
return NextResponse.json({ error: 'Unauthorized' }, { status: 401 });
}
}