17 lines
555 B
TypeScript
17 lines
555 B
TypeScript
import { getApiBaseUrl, jsonResponse } from '../../../../_lib/api';
|
|
|
|
export const dynamic = 'force-dynamic';
|
|
|
|
export async function GET(): Promise<Response> {
|
|
const token = await (await import('next/headers')).cookies().then(c => c.get('tower_super_token')?.value);
|
|
const res = await fetch(`${getApiBaseUrl()}/auth/super/me`, {
|
|
headers: {
|
|
Accept: 'application/json',
|
|
...(token ? { Authorization: `Bearer ${token}` } : {}),
|
|
},
|
|
cache: 'no-store',
|
|
});
|
|
const body = await res.json();
|
|
return jsonResponse(body, res.status);
|
|
}
|