mirror of
https://github.com/ansible/awx.git
synced 2026-02-16 18:50:04 -03:30
rejecting promise on requestError REST interceptor
This commit is contained in:
@@ -184,14 +184,14 @@ export default ['$log', '$cookieStore', '$compile', '$window', '$rootScope', '$l
|
|||||||
} else {
|
} else {
|
||||||
Wait('start');
|
Wait('start');
|
||||||
Authorization.retrieveToken(username, password)
|
Authorization.retrieveToken(username, password)
|
||||||
.success(function (data) {
|
.then(function (data) {
|
||||||
$('#login-modal').modal('hide');
|
$('#login-modal').modal('hide');
|
||||||
Authorization.setToken(data.token, data.expires);
|
Authorization.setToken(data.token, data.expires);
|
||||||
$rootScope.sessionTimer = Timer.init();
|
$rootScope.sessionTimer = Timer.init();
|
||||||
scope.$emit('AuthorizationGetUser');
|
scope.$emit('AuthorizationGetUser');
|
||||||
})
|
},
|
||||||
.error(function (data) {
|
function (data) {
|
||||||
var hdr, msg, key;
|
var key;
|
||||||
Wait('stop');
|
Wait('stop');
|
||||||
if (data.non_field_errors && data.non_field_errors.length === 0) {
|
if (data.non_field_errors && data.non_field_errors.length === 0) {
|
||||||
// show field specific errors returned by the API
|
// show field specific errors returned by the API
|
||||||
|
|||||||
@@ -11,8 +11,8 @@
|
|||||||
*************************************************/
|
*************************************************/
|
||||||
|
|
||||||
export default
|
export default
|
||||||
[ '$rootScope',
|
[ '$rootScope', '$q',
|
||||||
function ($rootScope) {
|
function ($rootScope, $q) {
|
||||||
return {
|
return {
|
||||||
response: function(config) {
|
response: function(config) {
|
||||||
if(config.headers('auth-token-timeout') !== null){
|
if(config.headers('auth-token-timeout') !== null){
|
||||||
@@ -23,9 +23,9 @@
|
|||||||
responseError: function(rejection){
|
responseError: function(rejection){
|
||||||
if( !_.isEmpty(rejection.data.detail) && rejection.data.detail === "Maximum per-user sessions reached"){
|
if( !_.isEmpty(rejection.data.detail) && rejection.data.detail === "Maximum per-user sessions reached"){
|
||||||
$rootScope.sessionTimer.expireSession('session_limit');
|
$rootScope.sessionTimer.expireSession('session_limit');
|
||||||
return rejection;
|
return $q.reject(rejection);
|
||||||
}
|
}
|
||||||
return rejection;
|
return $q.reject(rejection);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}];
|
}];
|
||||||
|
|||||||
Reference in New Issue
Block a user