Archived
dashboard: fix dashboard not supporting reverse proxy via rel path
This commit is contained in:
1 parent
73f94b4345
commit
742191a244
2 files changed
+30
-30
No files matched your search
@@ -94,7 +94,7 @@ export class HttpError extends Error {
|
||||
export async function api<T>(path: string, init?: RequestInit): Promise<T> {
|
||||
const headers: Record<string, string> = { ...(init?.headers as Record<string, string> | undefined) }
|
||||
if (apiKey) headers.Authorization = "Bearer " + apiKey
|
||||
const r = await fetch("/" + path, { cache: "no-store", ...init, headers })
|
||||
const r = await fetch(new URL(path, document.baseURI), { cache: "no-store", ...init, headers })
|
||||
if (r.status === 401) {
|
||||
if (!needKey) { needKey = true; listeners.forEach((f) => f()) }
|
||||
throw new HttpError(401, "an API key is required")
|
||||
|
||||
Reference in new issue
Block a user