diff --git a/awx/ui/client/src/inventories-hosts/inventories/related/groups/add/groups-add.controller.js b/awx/ui/client/src/inventories-hosts/inventories/related/groups/add/groups-add.controller.js index 9ede17bcf5..80a1d917b7 100644 --- a/awx/ui/client/src/inventories-hosts/inventories/related/groups/add/groups-add.controller.js +++ b/awx/ui/client/src/inventories-hosts/inventories/related/groups/add/groups-add.controller.js @@ -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 }); } }); diff --git a/awx/ui/client/src/inventories-hosts/inventories/related/groups/related/nested-groups/group-nested-groups-add.controller.js b/awx/ui/client/src/inventories-hosts/inventories/related/groups/related/nested-groups/group-nested-groups-add.controller.js index de61ced6b3..25633199bd 100644 --- a/awx/ui/client/src/inventories-hosts/inventories/related/groups/related/nested-groups/group-nested-groups-add.controller.js +++ b/awx/ui/client/src/inventories-hosts/inventories/related/groups/related/nested-groups/group-nested-groups-add.controller.js @@ -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 }); } }); diff --git a/awx/ui/client/src/inventories-hosts/inventories/related/sources/sources.service.js b/awx/ui/client/src/inventories-hosts/inventories/related/sources/sources.service.js index 8ac9b39248..ce65a7dae5 100644 --- a/awx/ui/client/src/inventories-hosts/inventories/related/sources/sources.service.js +++ b/awx/ui/client/src/inventories-hosts/inventories/related/sources/sources.service.js @@ -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; diff --git a/awx/ui/client/src/inventories-hosts/shared/groups.service.js b/awx/ui/client/src/inventories-hosts/shared/groups.service.js index caf31eca2f..0c6e1f8bef 100644 --- a/awx/ui/client/src/inventories-hosts/shared/groups.service.js +++ b/awx/ui/client/src/inventories-hosts/shared/groups.service.js @@ -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;