622737fdca
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
19 lines
715 B
TypeScript
19 lines
715 B
TypeScript
import { getApiBaseUrl, jsonResponse } from '../../../../_lib/api';
|
|
|
|
export const dynamic = 'force-dynamic';
|
|
|
|
async function getOrgToken(): Promise<string | undefined> {
|
|
const { cookies } = await import('next/headers');
|
|
return (await cookies()).get('tower_org_token')?.value;
|
|
}
|
|
|
|
export async function GET(_req: Request, { params }: { params: Promise<{ id: string }> }): Promise<Response> {
|
|
const { id } = await params;
|
|
const token = await getOrgToken();
|
|
const res = await fetch(`${getApiBaseUrl()}/org/tenants/${id}`, {
|
|
headers: { Accept: 'application/json', ...(token ? { Authorization: `Bearer ${token}` } : {}) },
|
|
cache: 'no-store',
|
|
});
|
|
return jsonResponse(await res.json(), res.status);
|
|
}
|