rejecting promise on requestError REST interceptor

This commit is contained in:
Jared Tabor 2015-10-06 12:10:51 -04:00
parent 6883d70805
commit 4ea2e10f1c
2 changed files with 8 additions and 8 deletions

View File

@ -184,14 +184,14 @@ export default ['$log', '$cookieStore', '$compile', '$window', '$rootScope', '$l
} else {
Wait('start');
Authorization.retrieveToken(username, password)
.success(function (data) {
.then(function (data) {
$('#login-modal').modal('hide');
Authorization.setToken(data.token, data.expires);
$rootScope.sessionTimer = Timer.init();
scope.$emit('AuthorizationGetUser');
})
.error(function (data) {
var hdr, msg, key;
},
function (data) {
var key;
Wait('stop');
if (data.non_field_errors && data.non_field_errors.length === 0) {
// show field specific errors returned by the API

View File

@ -11,8 +11,8 @@
*************************************************/
export default
[ '$rootScope',
function ($rootScope) {
[ '$rootScope', '$q',
function ($rootScope, $q) {
return {
response: function(config) {
if(config.headers('auth-token-timeout') !== null){
@ -23,9 +23,9 @@
responseError: function(rejection){
if( !_.isEmpty(rejection.data.detail) && rejection.data.detail === "Maximum per-user sessions reached"){
$rootScope.sessionTimer.expireSession('session_limit');
return rejection;
return $q.reject(rejection);
}
return rejection;
return $q.reject(rejection);
}
};
}];