Skip to content

Commit

Permalink
refactor(error-interceptor): remove redundant isLoginApi check
Browse files Browse the repository at this point in the history
Signed-off-by: Taranjeet Singh <[email protected]>
  • Loading branch information
singhtaranjeet committed Aug 25, 2023
1 parent ec8af86 commit 323322a
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions lib/src/interceptors/error_interceptor.dart
Original file line number Diff line number Diff line change
Expand Up @@ -121,15 +121,10 @@ abstract class ErrorInterceptor extends Interceptor {
}

bool checkIsLoginApi(UnauthenticatedError error) {
return isLoginApi(error.requestOptions.path) ||
error.requestOptions.headers
.containsKey(Constants.isAuthRequiredAPIKey);
return error.requestOptions.headers
.containsKey(Constants.isAuthRequiredAPIKey);
}

/// It will be called when `401` occurs and either [isLoginApi] returns `false`
/// or [isAuthRequiredAPIKey] is not present in headers
/// It will be called when `401` occurs and [isAuthRequiredAPIKey] is not present in headers
FutureOr handleUnauthenticatedUser(UnauthenticatedError error);

/// When returned `true` it will not call [handleUnauthenticatedUser] method for that request
bool isLoginApi(String path);
}

0 comments on commit 323322a

Please sign in to comment.