1
0
mirror of https://github.com/ansible/awx.git synced 2024-11-01 08:21:15 +03:00

[system_tracking] Ensure 401 errors in resolver handles sign out

This commit is contained in:
Joe Fiorini 2015-06-19 14:31:55 -04:00
parent c8744a8e8f
commit b6c18fcc13

View File

@ -15,12 +15,20 @@ export default {
moduleOptions:
[ 'getModuleOptions',
'lodashAsPromised',
'ProcessErrors',
'$route',
function(getModuleOptions, _, $route) {
function(getModuleOptions, _, ProcessErrors, $route) {
var hostIds = $route.current.params.hosts.split(',');
var data =
getModuleOptions(hostIds[0])
.catch(function (response) {
ProcessErrors(null, response.data, response.status, null, {
hdr: 'Error!',
msg: 'Failed to get license info. GET returned status: ' +
response.status
});
})
.value();
return data;
@ -32,7 +40,8 @@ export default {
'$q',
'Rest',
'GetBasePath',
function($route, $q, rest, getBasePath) {
'ProcessErrors',
function($route, $q, rest, getBasePath, ProcessErrors) {
if ($route.current.hasModelKey('inventory')) {
return $q.when($route.current.params.model.inventory);
}
@ -44,6 +53,12 @@ export default {
return rest.get()
.then(function(data) {
return data.data;
}).catch(function (response) {
ProcessErrors(null, response.data, response.status, null, {
hdr: 'Error!',
msg: 'Failed to get license info. GET returned status: ' +
response.status
});
});
}
],
@ -52,7 +67,8 @@ export default {
'$q',
'Rest',
'GetBasePath',
function($route, $q, rest, getBasePath) {
'ProcessErrors',
function($route, $q, rest, getBasePath, ProcessErrors) {
if ($route.current.hasModelKey('hosts')) {
return $q.when($route.current.params.model.hosts);
}
@ -68,6 +84,12 @@ export default {
return rest.get()
.then(function(data) {
return data.data;
}).catch(function (response) {
ProcessErrors(null, response.data, response.status, null, {
hdr: 'Error!',
msg: 'Failed to get license info. GET returned status: ' +
response.status
});
});
});