Fix: Don't send Authorization header for auth endpoints

This commit is contained in:
Motoko
2026-03-30 15:59:00 +00:00
parent 857a3123a8
commit 10a052da78

View File

@@ -30,7 +30,9 @@ export function useApi() {
...(options.headers as Record<string, string> || {}) ...(options.headers as Record<string, string> || {})
} }
if (authStore.token) { // Only add Authorization header for non-auth endpoints
// Auth endpoints (login, register, refresh) should NOT receive the old token
if (authStore.token && !endpoint.includes('/auth/')) {
headers['Authorization'] = `Bearer ${authStore.token}` headers['Authorization'] = `Bearer ${authStore.token}`
} }