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

fixes error handling with groups service, sources service

This commit is contained in:
Jared Tabor 2018-04-30 15:11:34 -07:00
parent 05556809d3
commit 421293c8c5
No known key found for this signature in database
GPG Key ID: 1B343EC4C3CF7E5C
4 changed files with 10 additions and 10 deletions

View File

@ -49,10 +49,10 @@ export default ['$state', '$stateParams', '$scope', 'GroupForm',
};
GroupsService.post(group).then(res => {
if ($stateParams.group_id) {
if ($stateParams.group_id && _.has(res, 'data')) {
return GroupsService.associateGroup(res.data, $stateParams.group_id)
.then(() => $state.go('^', null, { reload: true }));
} else {
} else if(_.has(res, 'data.id')){
$state.go('^.edit', { group_id: res.data.id }, { reload: true });
}
});

View File

@ -45,10 +45,10 @@ export default ['$state', '$stateParams', '$scope', 'NestedGroupForm',
};
GroupsService.post(group).then(res => {
if ($stateParams.group_id) {
if ($stateParams.group_id && _.has(res, 'data')) {
return GroupsService.associateGroup(res.data, $stateParams.group_id)
.then(() => $state.go('^', null, { reload: true }));
} else {
} else if(_.has(res, 'data.id')){
$state.go('^.edit', { group_id: res.data.id }, { reload: true });
}
});

View File

@ -10,9 +10,9 @@ export default
url: function(){
return '';
},
error: function(data, status) {
ProcessErrors($rootScope, data, status, null, { hdr: 'Error!',
msg: 'Call to ' + this.url + '. GET returned: ' + status });
error: function(data) {
ProcessErrors($rootScope, data.data, data.status, null, { hdr: 'Error!',
msg: 'Call to ' + this.url + '. GET returned: ' + data.status });
},
success: function(data){
return data;

View File

@ -10,9 +10,9 @@ export default
url: function(){
return '';
},
error: function(data, status) {
ProcessErrors($rootScope, data, status, null, { hdr: 'Error!',
msg: 'Call to ' + this.url + '. GET returned: ' + status });
error: function(data) {
ProcessErrors($rootScope, data.data, data.status, null, { hdr: 'Error!',
msg: 'Call to ' + this.url + '. GET returned: ' + data.status });
},
success: function(data){
return data;