From deec2fe69d37408ac379e4fc08e404f1cc64b2e3 Mon Sep 17 00:00:00 2001 From: Nils Schneider Date: Mon, 24 Nov 2025 21:25:45 +0100 Subject: [PATCH] refactor: enforce `setAuthToken` to strictly require a token, add `/notes` to gitignore, and include logo asset. --- frontend/src/app/ApiContext.tsx | 2 +- frontend/src/lib/apiClient.ts | 8 ++------ 2 files changed, 3 insertions(+), 7 deletions(-) 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 = () => {