fixing platform admin

This commit is contained in:
root
2026-05-06 22:58:23 -04:00
parent 695a7f7cc7
commit 750ae56a29
175 changed files with 31249 additions and 328 deletions
+14
View File
@@ -0,0 +1,14 @@
const API_BASE =
(typeof window === 'undefined' ? process.env.API_INTERNAL_URL : '/api/v1')
?? process.env.NEXT_PUBLIC_API_URL
?? 'http://localhost:4000/api/v1'
export async function adminFetch<T>(path: string, token?: string): Promise<T> {
const res = await fetch(`${API_BASE}${path}`, {
cache: 'no-store',
headers: token ? { Authorization: `Bearer ${token}` } : undefined,
})
const json = await res.json()
if (!res.ok) throw new Error(json?.message ?? 'Request failed')
return json.data as T
}