diff --git a/frontend/src/lib/api.ts b/frontend/src/lib/api.ts index 3648c2c..a656413 100644 --- a/frontend/src/lib/api.ts +++ b/frontend/src/lib/api.ts @@ -6,16 +6,19 @@ function buildUrl(path: string) { type RequestOptions = Omit & { body?: any + skipAuth?: boolean } export async function apiFetch(path: string, options: RequestOptions = {}) { - const { body, headers, ...rest } = options + const { body, headers, skipAuth, ...rest } = options - const storedUser = localStorage.getItem('user') let authHeader = {} - if (storedUser) { - const userData = JSON.parse(storedUser) - authHeader = { 'Authorization': `Bearer ${userData.jwt}` } + if (!skipAuth) { + const storedUser = localStorage.getItem('user') + if (storedUser) { + const userData = JSON.parse(storedUser) + authHeader = { 'Authorization': `Bearer ${userData.jwt}` } + } } const response = await fetch(buildUrl(path), { diff --git a/frontend/src/services/statusService.ts b/frontend/src/services/statusService.ts index c40ca5b..f028149 100644 --- a/frontend/src/services/statusService.ts +++ b/frontend/src/services/statusService.ts @@ -16,5 +16,6 @@ export type BackendHealthResponse = { export async function getBackendStatus() { return apiFetch("/q/status", { method: "GET", + skipAuth: true, }); }