fix admin pages

This commit is contained in:
root
2026-05-17 17:37:13 -04:00
parent 0b73504455
commit 5ea1780134
12 changed files with 42 additions and 53 deletions
+5 -5
View File
@@ -1,10 +1,10 @@
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 const ADMIN_API_BASE =
typeof window === 'undefined'
? (process.env.API_INTERNAL_URL ?? process.env.NEXT_PUBLIC_API_URL ?? 'http://localhost:4000/api/v1')
: (process.env.NEXT_PUBLIC_API_URL ?? '/admin/api/v1')
export async function adminFetch<T>(path: string, token?: string): Promise<T> {
const res = await fetch(`${API_BASE}${path}`, {
const res = await fetch(`${ADMIN_API_BASE}${path}`, {
cache: 'no-store',
headers: token ? { Authorization: `Bearer ${token}` } : undefined,
})