From 55e6206d7438d9ac9c954638667e499b85b7f610 Mon Sep 17 00:00:00 2001 From: Jared Tabor Date: Tue, 6 Oct 2015 12:10:51 -0400 Subject: [PATCH] rejecting promise on requestError REST interceptor --- .../client/src/login/loginModal/loginModal.controller.js | 8 ++++---- awx/ui/client/src/rest/interceptors.service.js | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/awx/ui/client/src/login/loginModal/loginModal.controller.js b/awx/ui/client/src/login/loginModal/loginModal.controller.js index 5aeb6a2eb3..52296a4c62 100644 --- a/awx/ui/client/src/login/loginModal/loginModal.controller.js +++ b/awx/ui/client/src/login/loginModal/loginModal.controller.js @@ -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 diff --git a/awx/ui/client/src/rest/interceptors.service.js b/awx/ui/client/src/rest/interceptors.service.js index 1a5d4f13a5..2564df40cd 100644 --- a/awx/ui/client/src/rest/interceptors.service.js +++ b/awx/ui/client/src/rest/interceptors.service.js @@ -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); } }; }];