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}` } : {}),