diff --git a/src/components/cells/ProductionNameCell.vue b/src/components/cells/ProductionNameCell.vue index 6cd7a37106..202930194c 100644 --- a/src/components/cells/ProductionNameCell.vue +++ b/src/components/cells/ProductionNameCell.vue @@ -119,7 +119,9 @@ export default { }, thumbnailPath() { - return `/api/pictures/thumbnails/projects/${this.entry.id}.png` + const lastUpdate = this.entry.updated_at || this.entry.created_at + const timestamp = Date.parse(lastUpdate) + return `/api/pictures/thumbnails/projects/${this.entry.id}.png?t=${timestamp}` } }, diff --git a/src/components/pages/OpenProductions.vue b/src/components/pages/OpenProductions.vue index 727e95c380..13a350c6bf 100644 --- a/src/components/pages/OpenProductions.vue +++ b/src/components/pages/OpenProductions.vue @@ -258,7 +258,9 @@ export default { }, getThumbnailPath(production) { - return `/api/pictures/thumbnails/projects/${production.id}.png` + const lastUpdate = production.updated_at || production.created_at + const timestamp = Date.parse(lastUpdate) + return `/api/pictures/thumbnails/projects/${production.id}.png?t=${timestamp}` }, newProductionPage() { diff --git a/src/components/pages/Productions.vue b/src/components/pages/Productions.vue index 34d2b8c84d..be45798d93 100644 --- a/src/components/pages/Productions.vue +++ b/src/components/pages/Productions.vue @@ -112,6 +112,7 @@ export default { methods: { ...mapActions([ 'deleteProduction', + 'editProduction', 'loadProductions', 'loadProductionStats', 'storeProductionPicture', @@ -120,34 +121,23 @@ export default { // Actions - confirmEditProduction(form) { - let action = 'newProduction' - const isEditing = this.productionToEdit && this.productionToEdit.id - if (isEditing) { - action = 'editProduction' - form.id = this.productionToEdit.id - } - + async confirmEditProduction(form) { this.loading.edit = true this.errors.edit = false - this.$store - .dispatch(action, form) - .then(() => { - if (isEditing && this.productionAvatarFormData) { - return this.uploadProductionAvatar(form.id) - } else { - return Promise.resolve() - } - }) - .then(() => { - this.modals.isEditDisplayed = false - this.loading.edit = false - }) - .catch(err => { - console.error(err) - this.loading.edit = false - this.errors.edit = true + try { + if (this.productionAvatarFormData) { + await this.uploadProductionAvatar(this.productionToEdit.id) + } + await this.editProduction({ + ...form, + id: this.productionToEdit.id }) + this.modals.isEditDisplayed = false + } catch (error) { + console.error(error) + this.errors.edit = true + } + this.loading.edit = false }, confirmDeleteProduction() { @@ -177,6 +167,7 @@ export default { // Events onEditClicked(production) { + this.storeProductionPicture(null) this.productionToEdit = production this.modals.isEditDisplayed = true }, diff --git a/src/components/pages/production/ProductionParameters.vue b/src/components/pages/production/ProductionParameters.vue index d64f352518..4601810602 100644 --- a/src/components/pages/production/ProductionParameters.vue +++ b/src/components/pages/production/ProductionParameters.vue @@ -167,15 +167,16 @@