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:
parent
05556809d3
commit
421293c8c5
@ -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 });
|
||||
}
|
||||
});
|
||||
|
@ -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 });
|
||||
}
|
||||
});
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user