I have a ValidationInterceptor which should force logout when some event is occurred.
How can I do this?
class ValidationInterceptor extends Interceptor {
@override
onError(DioException err, ErrorInterceptorHandler handler) {
if(err.type == DioResponseType.badRequest && err.response!.statusCode == 401) {
final logoutUri = Uri(path: '/logout');
// ...
// need to redirect to logout
// ...
handler.reject(err); // do I need this?
} else {
handler.next(err);
}
}
}
I have a ValidationInterceptor which should force logout when some event is occurred.
How can I do this?