From 84655bcf70f4515ba14b059e0bd6c46ac429883b Mon Sep 17 00:00:00 2001 From: Mateus Machado Luna Date: Fri, 4 May 2018 12:50:05 -0300 Subject: [PATCH] Refresh thumbnail when selecting an attachment file and back automatically generates one. --- src/admin/components/edition/item-edition-form.vue | 5 +++++ src/js/store/modules/item/actions.js | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/admin/components/edition/item-edition-form.vue b/src/admin/components/edition/item-edition-form.vue index e3437f3e7..8615ce6ae 100644 --- a/src/admin/components/edition/item-edition-form.vue +++ b/src/admin/components/edition/item-edition-form.vue @@ -468,6 +468,11 @@ export default { this.updateItemDocument({ item_id: this.itemId, document: this.form.document, document_type: this.form.document_type }) .then((item) => { this.item.document_as_html = item.document_as_html; + + let oldThumbnail = this.item.thumbnail; + if (item.document_type == 'attachment' && oldThumbnail != item.thumbnail ) + this.item.thumbnail = item.thumbnail; + }) .catch(error => this.$console.error(error)); } diff --git a/src/js/store/modules/item/actions.js b/src/js/store/modules/item/actions.js index a4c26df7b..5d138c6f1 100644 --- a/src/js/store/modules/item/actions.js +++ b/src/js/store/modules/item/actions.js @@ -118,7 +118,9 @@ export const updateItemDocument = ({ commit }, { item_id, document, document_typ document: document, document_type: document_type }).then( res => { - commit('setItem', res.data); + let item = res.data; + + commit('setItem', item); resolve( res.data ); }).catch( error => { reject({ error_message: error['response']['data'].error_message, errors: error['response']['data'].errors });