From c1650fd1a44f7e4eac31b9422a597edcd20b363e Mon Sep 17 00:00:00 2001 From: Tiago Yamamoto Date: Wed, 24 Dec 2025 17:16:54 -0300 Subject: [PATCH] fix(frontend): check both 'auth_token' and 'token' in api client Unblocks API calls by correctly reading the token saved by auth.ts --- frontend/src/lib/api.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/frontend/src/lib/api.ts b/frontend/src/lib/api.ts index 0131763..44c0155 100644 --- a/frontend/src/lib/api.ts +++ b/frontend/src/lib/api.ts @@ -16,7 +16,8 @@ function logCrudAction(action: string, entity: string, details?: any) { * Generic API Request Wrapper */ async function apiRequest(endpoint: string, options: RequestInit = {}): Promise { - const token = localStorage.getItem("token"); + // Token can be stored as 'auth_token' (from auth.ts login) or 'token' (legacy) + const token = localStorage.getItem("auth_token") || localStorage.getItem("token"); const headers = { "Content-Type": "application/json", ...(token ? { Authorization: `Bearer ${token}` } : {}),