From 8af325d3d06bdc716b2ca372a434db0a6b1587e7 Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Wed, 26 Jan 2022 15:17:53 +0100 Subject: [PATCH] more compact code --- admin/src/pages/CreationConfirm.vue | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/admin/src/pages/CreationConfirm.vue b/admin/src/pages/CreationConfirm.vue index 712e4ece1..202133460 100644 --- a/admin/src/pages/CreationConfirm.vue +++ b/admin/src/pages/CreationConfirm.vue @@ -36,8 +36,7 @@ export default { }, }) .then((result) => { - this.pendingCreations = this.pendingCreations.filter((obj) => obj.id !== item.id) - this.$store.commit('openCreationsMinus', 1) + this.updatePendingCreations(item.id) this.$toasted.success(this.$t('creation_form.toasted_delete')) }) .catch((error) => { @@ -53,8 +52,7 @@ export default { }, }) .then((result) => { - this.pendingCreations = this.pendingCreations.filter((obj) => obj.id !== item.id) - this.$store.commit('openCreationsMinus', 1) + this.updatePendingCreations(item.id) this.$toasted.success(this.$t('creation_form.toasted_created')) }) .catch((error) => { @@ -76,6 +74,10 @@ export default { this.$toasted.error(error.message) }) }, + updatePendingCreations(id) { + this.pendingCreations = this.pendingCreations.filter((obj) => obj.id !== id) + this.$store.commit('openCreationsMinus', 1) + }, }, computed: { fields() {