Open
Description
It certainly has been useful for me when working with tokens. Are people wary of supporting a non-standard status code like 419?
.config(['$httpProvider', function($httpProvider) {
$httpProvider.interceptors.push(['$rootScope', '$q', 'httpBuffer', function($rootScope, $q, httpBuffer) {
return {
responseError: function(rejection) {
if (!rejection.config.ignoreAuthModule) {
switch (rejection.status) {
case 419:
case 401:
var deferred = $q.defer();
httpBuffer.append(rejection.config, deferred);
$rootScope.$broadcast('event:auth-loginRequired', rejection);
return deferred.promise;
case 403:
$rootScope.$broadcast('event:auth-forbidden', rejection);
break;
}
}
// otherwise, default behaviour
return $q.reject(rejection);
}
};
}]);
}]);
Metadata
Metadata
Assignees
Labels
No labels