fix: suppress all network errors during logout and clear snackbars before navigation

This commit is contained in:
pradeepkumar
2026-03-31 06:04:30 +05:30
parent 145cf53fdb
commit 597b97414d
2 changed files with 7 additions and 5 deletions

View File

@@ -62,13 +62,14 @@ class ApiClient {
return InterceptorsWrapper(
onError: (error, handler) async {
// Handle 401 — attempt token refresh
if (error.response?.statusCode == 401) {
// During logout, silently reject 401s without showing errors
// During logout, silently swallow ALL errors
if (suppressAuthErrors) {
handler.reject(error);
return;
}
if (error.response?.statusCode == 401) {
final requestUrl = error.requestOptions.path;
// Don't try to refresh if this was the refresh request itself

View File

@@ -323,6 +323,7 @@ class _MenuDrawer extends ConsumerWidget {
child: ElevatedButton(
onPressed: () {
Navigator.pop(context);
ScaffoldMessenger.of(context).clearSnackBars();
ref.read(authProvider.notifier).logout();
},
style: ElevatedButton.styleFrom(