diff --git a/admin/src/pages/CreationConfirm.spec.js b/admin/src/pages/CreationConfirm.spec.js index ed3d33543..fb59d1598 100644 --- a/admin/src/pages/CreationConfirm.spec.js +++ b/admin/src/pages/CreationConfirm.spec.js @@ -194,14 +194,13 @@ describe('CreationConfirm', () => { describe('delete creation delete with error', () => { beforeEach(async () => { - apolloMutateMock.mockRejectedValue({ message: 'Ouchhh!' }) await wrapper .findComponent({ name: 'UserTable' }) .vm.$emit('remove-confirm-result', { id: 1 }, 'confirm') }) it('toasts an error message', () => { - expect(toastedErrorMock).not.toBeCalledWith('Ouchhh!') + expect(toastedErrorMock).toBeCalledWith('Case confirm is not supported') }) }) diff --git a/admin/src/pages/CreationConfirm.vue b/admin/src/pages/CreationConfirm.vue index 62e850537..578c9b23f 100644 --- a/admin/src/pages/CreationConfirm.vue +++ b/admin/src/pages/CreationConfirm.vue @@ -53,27 +53,32 @@ export default { removeConfirmResult(e, event) { let index = 0 const findArr = this.confirmResult.find((arr) => arr.id === e.id) - if (event === 'remove') { - this.$apollo - .mutate({ - mutation: deletePendingCreation, - variables: { - id: findArr.id, - }, - }) - .then((result) => { - index = this.confirmResult.indexOf(findArr) - this.confirmResult.splice(index, 1) - this.$store.commit('openCreationsMinus', 1) - this.$toasted.success('Pending Creation has been deleted') - }) - .catch((error) => { - this.$toasted.error(error.message) - }) - } else { - this.confirmResult.splice(index, 1) - this.$store.commit('openCreationsMinus', 1) - this.$toasted.success('Pending Creation has been deleted') + switch (event) { + case 'remove': + this.$apollo + .mutate({ + mutation: deletePendingCreation, + variables: { + id: findArr.id, + }, + }) + .then((result) => { + index = this.confirmResult.indexOf(findArr) + this.confirmResult.splice(index, 1) + this.$store.commit('openCreationsMinus', 1) + this.$toasted.success('Pending Creation has been deleted') + }) + .catch((error) => { + this.$toasted.error(error.message) + }) + break + case 'confirmed': + this.confirmResult.splice(index, 1) + this.$store.commit('openCreationsMinus', 1) + this.$toasted.success('Pending Creation has been deleted') + break + default: + this.$toasted.error('Case ' + event + ' is not supported') } }, getPendingCreations() {