Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit aa4aaac

Browse files
committed
New feature: error handler ignores requests with 'ignoreAuthModule' configuration option.
1 parent fa5ec2d commit aa4aaac

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/angular-http-auth.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ angular.module('http-auth-interceptor', [])
5151

5252
/**
5353
* $http interceptor.
54-
* On 401 response - it stores the request and broadcasts 'event:angular-auth-loginRequired'.
54+
* On 401 response (without 'ignoreAuthModule' option) - it stores the request
55+
* and broadcasts 'event:angular-auth-loginRequired'.
5556
*/
5657
.config(['$httpProvider', 'authServiceProvider', function($httpProvider, authServiceProvider) {
5758

@@ -61,13 +62,13 @@ angular.module('http-auth-interceptor', [])
6162
}
6263

6364
function error(response) {
64-
if (response.status === 401) {
65+
if (response.status === 401 && !response.config.ignoreAuthModule) {
6566
var deferred = $q.defer();
6667
authServiceProvider.pushToBuffer(response.config, deferred);
6768
$rootScope.$broadcast('event:auth-loginRequired');
6869
return deferred.promise;
6970
}
70-
// otherwise
71+
// otherwise, default behaviour
7172
return $q.reject(response);
7273
}
7374

0 commit comments

Comments
 (0)