mirror of
https://github.com/ansible/awx.git
synced 2026-01-12 10:30:03 -03:30
rejecting promise on requestError REST interceptor
This commit is contained in:
parent
6883d70805
commit
4ea2e10f1c
@ -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
|
||||
|
||||
@ -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);
|
||||
}
|
||||
};
|
||||
}];
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user