onError method
- DioException err,
- ErrorInterceptorHandler handler
override
Called when an exception was occurred during the request.
Implementation
@override
Future<void> onError(
DioException err,
ErrorInterceptorHandler handler,
) async {
final int? statusCode = err.response?.statusCode;
if (statusCode == HttpStatus.unauthorized ||
statusCode == HttpStatus.forbidden) {
// TODO(all): implement usage of refresh token instead of logout
// GetIt.I.get<AuthenticationBloc>().add(
// const AuthenticationEvent.loggedOut(),
// );
} else {
return handler.next(err);
}
}