fix: suppress all network errors during logout and clear snackbars before navigation
This commit is contained in:
@@ -62,12 +62,13 @@ class ApiClient {
|
|||||||
return InterceptorsWrapper(
|
return InterceptorsWrapper(
|
||||||
onError: (error, handler) async {
|
onError: (error, handler) async {
|
||||||
// Handle 401 — attempt token refresh
|
// Handle 401 — attempt token refresh
|
||||||
|
// During logout, silently swallow ALL errors
|
||||||
|
if (suppressAuthErrors) {
|
||||||
|
handler.reject(error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (error.response?.statusCode == 401) {
|
if (error.response?.statusCode == 401) {
|
||||||
// During logout, silently reject 401s without showing errors
|
|
||||||
if (suppressAuthErrors) {
|
|
||||||
handler.reject(error);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
final requestUrl = error.requestOptions.path;
|
final requestUrl = error.requestOptions.path;
|
||||||
|
|
||||||
|
|||||||
@@ -323,6 +323,7 @@ class _MenuDrawer extends ConsumerWidget {
|
|||||||
child: ElevatedButton(
|
child: ElevatedButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
|
ScaffoldMessenger.of(context).clearSnackBars();
|
||||||
ref.read(authProvider.notifier).logout();
|
ref.read(authProvider.notifier).logout();
|
||||||
},
|
},
|
||||||
style: ElevatedButton.styleFrom(
|
style: ElevatedButton.styleFrom(
|
||||||
|
|||||||
Reference in New Issue
Block a user