fix: remove auto-redirect from API client on 401

The API client was redirecting to /login on any 401 response,
including the checkAuth() call in the layout. This caused a
redirect loop that cleared the token. Auth redirects are now
handled solely by the layout's checkAuth() flow.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-20 00:19:30 +03:00
parent 7d01ae669a
commit e43c2ed924
+2
View File
@@ -13,6 +13,8 @@
const path = window.location.pathname;
const publicPaths = ['/login', '/setup'];
console.log('[auth]', { path, needsSetup: getNeedsSetup(), authenticated: isAuthenticated(), token: !!localStorage.getItem('nb_token') });
if (getNeedsSetup() && path !== '/setup') {
window.location.href = '/setup';
} else if (!getNeedsSetup() && !isAuthenticated() && !publicPaths.includes(path)) {