diff --git a/frontend/src/app/ApiContext.tsx b/frontend/src/app/ApiContext.tsx index 901ccc5..d7abd48 100644 --- a/frontend/src/app/ApiContext.tsx +++ b/frontend/src/app/ApiContext.tsx @@ -6,7 +6,7 @@ type HttpClient = typeof httpClient; interface ApiContextValue { client: HttpClient; - setAuthToken: (token?: string | null) => void; + setAuthToken: (token: string) => void; clearAuthToken: () => void; } diff --git a/frontend/src/lib/apiClient.ts b/frontend/src/lib/apiClient.ts index 93f0df1..672e718 100644 --- a/frontend/src/lib/apiClient.ts +++ b/frontend/src/lib/apiClient.ts @@ -281,12 +281,8 @@ export const listTenants = async (): Promise => { return Array.isArray(data?.tenants) ? data.tenants : []; }; -export const setAuthToken = (token?: string | null) => { - if (token) { - api.defaults.headers.common.Authorization = `Bearer ${token}`; - } else { - delete api.defaults.headers.common.Authorization; - } +export const setAuthToken = (token: string) => { + api.defaults.headers.common.Authorization = `Bearer ${token}`; }; export const clearAuthToken = () => {