From 815f8ac5acd7f479d6db3864e54ac5e7b08ef776 Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Sun, 25 Apr 2021 19:04:52 +0200 Subject: [PATCH] Documents: fix delete --- assets/vue/mixins/UpdateMixin.js | 17 +++++++++++++---- assets/vue/store/modules/crud.js | 1 + 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/assets/vue/mixins/UpdateMixin.js b/assets/vue/mixins/UpdateMixin.js index 1a4ff901cd..b7eb4d7c35 100644 --- a/assets/vue/mixins/UpdateMixin.js +++ b/assets/vue/mixins/UpdateMixin.js @@ -14,7 +14,7 @@ export default { }, }; }, - mounted() { + created() { console.log('mounted'); // Changed let id = this.$route.params.id; @@ -35,6 +35,7 @@ export default { retrieved() { // call from list console.log('update mixin retrieved'); + let id = this.$route.params.id; console.log('first'); console.log(id); @@ -44,10 +45,16 @@ export default { console.log(id); } - let item = this.find(decodeURIComponent(id)); - console.log(item); + if (!isEmpty(id)) { + let item = this.find(decodeURIComponent(id)); + + if (isEmpty(item)) { + this.retrieve(decodeURIComponent(id)); + } + + return item; + } - return item; //return this.find(decodeURIComponent(this.$route.params.id)); } @@ -57,6 +64,7 @@ export default { console.log(this.retrieved); this.deleteItem(this.retrieved).then(() => { + console.log('deleteItem resykt'); let folderParams = this.$route.query; //this.showMessage(`${this.item['@id']} deleted.`); this.$router @@ -80,6 +88,7 @@ export default { updateForm.v$.$touch(); if (!updateForm.v$.$invalid) { this.update(updateForm.v$.item.$model); + this.item = { ...this.retrieved }; } }, diff --git a/assets/vue/store/modules/crud.js b/assets/vue/store/modules/crud.js index 8d8ffc71df..c51fcef414 100644 --- a/assets/vue/store/modules/crud.js +++ b/assets/vue/store/modules/crud.js @@ -150,6 +150,7 @@ export default function makeCrudModule({ { commit }, { params = { properties: ['@id', 'name'] } } = {} ) => { + console.log('fetchSelectItems'); commit(ACTIONS.TOGGLE_LOADING); if (!service) throw new Error('No service specified!');