more compact code

This commit is contained in:
Moriz Wahl 2022-01-26 15:17:53 +01:00
parent eb2d2a0d3d
commit 8af325d3d0

View File

@ -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() {