21 lines
459 B
TypeScript
21 lines
459 B
TypeScript
import { NextResponse } from 'next/server';
|
|
|
|
import { getSessionUser } from '@/lib/auth/session';
|
|
|
|
export const dynamic = 'force-dynamic';
|
|
|
|
export async function GET() {
|
|
const user = await getSessionUser();
|
|
if (!user) {
|
|
return NextResponse.json({ user: null }, { status: 401 });
|
|
}
|
|
return NextResponse.json({
|
|
user: {
|
|
id: user.id,
|
|
email: user.email,
|
|
is_approved: user.is_approved,
|
|
is_admin: user.is_admin,
|
|
},
|
|
});
|
|
}
|