Files
Nils-Johan Gynther ffe50e5151
Test Suite / test (24.15.0) (push) Has been cancelled
feat: add TypeScript definitions for next-auth session with accessToken and user details
2026-05-04 20:09:21 +02:00

16 lines
480 B
TypeScript

import { NextResponse } from 'next/server';
import { auth } from '../../../auth';
export async function GET() {
const session = await auth();
if ((session?.user as any)?.role !== 'admin') {
return NextResponse.json({ error: 'Forbidden' }, { status: 403 });
}
const key = process.env.MISTRAL_API_KEY ?? '';
const keyHint = key.length >= 4 ? key.slice(-4) : '????';
const hasKey = key.length > 0;
return NextResponse.json({ keyHint, hasKey });
}