fix(auth): remove auto-signout on 401 in AuthInterceptor
The AuthInterceptor was calling signOut() on any 401 error, which caused the theme toggle to trigger logout when the preferences API returned 401. Now 401 errors propagate to calling code for graceful handling. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.5
parent
6b6614f482
commit
04032a6dbc
@@ -38,16 +38,9 @@ class AuthInterceptor extends Interceptor {
|
||||
|
||||
@override
|
||||
void onError(DioException err, ErrorInterceptorHandler handler) {
|
||||
// Skip auth error handling for LAN development
|
||||
if (!AppConfig.requiresAuth) {
|
||||
handler.next(err);
|
||||
return;
|
||||
}
|
||||
|
||||
if (err.response?.statusCode == 401) {
|
||||
// Token expired - trigger re-authentication
|
||||
_ref.read(authProvider.notifier).signOut();
|
||||
}
|
||||
// Don't auto-signout on 401 - let calling code handle auth errors gracefully.
|
||||
// Auto-signout was causing issues (e.g., theme toggle triggering logout when
|
||||
// preferences API returned 401).
|
||||
handler.next(err);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user