/admin and with working with db. data is pulling from db
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
import { getToken } from 'next-auth/jwt';
|
||||
import { NextRequest, NextResponse } from 'next/server';
|
||||
|
||||
export async function GET(request: NextRequest) {
|
||||
const token = await getToken({
|
||||
req: request,
|
||||
secret: process.env.NEXTAUTH_SECRET
|
||||
});
|
||||
|
||||
console.log('Check Admin API - Token:', token);
|
||||
console.log('Check Admin API - isAdmin:', token?.isAdmin);
|
||||
|
||||
return NextResponse.json({
|
||||
isAdmin: token?.isAdmin || false,
|
||||
token: token
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user