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:
@@ -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)) {
|
||||
|
||||
Reference in New Issue
Block a user