Files
tower/apps/web/app/api/admin/orgs/[id]/route.ts
T

19 lines
720 B
TypeScript

import { getApiBaseUrl, jsonResponse } from '../../../../_lib/api';
export const dynamic = 'force-dynamic';
async function getSuperToken(): Promise<string | undefined> {
const { cookies } = await import('next/headers');
return (await cookies()).get('tower_super_token')?.value;
}
export async function GET(_req: Request, { params }: { params: Promise<{ id: string }> }): Promise<Response> {
const { id } = await params;
const token = await getSuperToken();
const res = await fetch(`${getApiBaseUrl()}/admin/orgs/${id}`, {
headers: { Accept: 'application/json', ...(token ? { Authorization: `Bearer ${token}` } : {}) },
cache: 'no-store',
});
return jsonResponse(await res.json(), res.status);
}