feat: some changes and admin
This commit is contained in:
20
nextjs/src/app/api/auth/me/route.ts
Normal file
20
nextjs/src/app/api/auth/me/route.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
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,
|
||||
},
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user