From 02b8556b025061f82f7d576feef1fd9932e09bb7 Mon Sep 17 00:00:00 2001 From: Gabriel Santana de Menezes Date: Fri, 15 May 2026 15:39:32 -0400 Subject: [PATCH] fix: skip auth header on unprotected health status endpoint --- frontend/src/lib/api.ts | 13 ++++++++----- frontend/src/services/statusService.ts | 1 + 2 files changed, 9 insertions(+), 5 deletions(-) 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, }); }