Skip to content

Commit

Permalink
fix: check if signed in before logging out
Browse files Browse the repository at this point in the history
  • Loading branch information
adar2378 committed Dec 20, 2023
1 parent 8316d64 commit e830367
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ class JwtAuthInterceptor extends Interceptor {
@override
void onError(DioException err, ErrorInterceptorHandler handler) {
if (err.response?.statusCode == 401) {
AuthCubit.instance.logout();
final isSignedIn = AuthCubit.instance.state.token != null;
if (isSignedIn) {
AuthCubit.instance.logout();
}
}
super.onError(err, handler);
}
Expand Down

0 comments on commit e830367

Please sign in to comment.