-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(interceptors): add UnauthorizedInterceptor to handle 401 errors #930
Conversation
import 'package:pass_emploi_app/repositories/remote_config_repository.dart'; | ||
import 'package:redux/redux.dart'; | ||
|
||
class UnauthorizedInterceptor extends PassEmploiBaseInterceptor { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Peut etre nommer l'interceptor en LogoutAfterTooMany401Interceptor ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bonne idée
|
||
@override | ||
void onPassEmploiError(DioException err, ErrorInterceptorHandler handler) { | ||
final maxUnauthorizedErrorsBeforeLogout = _remoteConfigRepository.maxUnauthorizedErrorsBeforeLogout(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
en termes de perf ça bouffe quoi d'avoir ce genre d'interceptor qui écoute en permanence les status code d'appel d'api ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
C'est pas grand chose. C'est un appel de fonction en plus avec un if. Il n'y a pas de grosse logique donc même avec un iphone 4s pas de soucis
} | ||
|
||
void _onUnauthorizedErrorCountExceeded() { | ||
_store.dispatch(RequestLogoutAction(LogoutReason.tooMany401)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
et cette fonction elle force le logout aussi ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oui le logout est piloté dans Redux
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GG BG
…any401Interceptor and update references
No description provided.