From 76be36fbb9ff6a7b5f9aa8b02de8cf69b25ee3e3 Mon Sep 17 00:00:00 2001 From: Alejandro MG Date: Thu, 31 Oct 2024 11:00:53 +0100 Subject: [PATCH] Automatically saves duplicated declarations --- frontend/src/views/ProducerFormPage/index.vue | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/frontend/src/views/ProducerFormPage/index.vue b/frontend/src/views/ProducerFormPage/index.vue index e2c89a6d..c9b764ca 100644 --- a/frontend/src/views/ProducerFormPage/index.vue +++ b/frontend/src/views/ProducerFormPage/index.vue @@ -157,7 +157,7 @@ watch(data, () => { const shouldDuplicate = route.query.duplicate && !props.id if (shouldDuplicate) { performDuplication(data.value) - useToaster().addSuccessMessage("Votre déclaration a été dupliquée. Merci de renseigner les pièces jointes.") + savePayload("Votre déclaration a été dupliquée. Merci de renseigner les pièces jointes.") } else payload.value = data.value }) @@ -193,7 +193,7 @@ const components = computed(() => { const titles = computed(() => tabTitles(components.value, !readonly.value)) -const savePayload = async () => { +const savePayload = async (successMessage = "Votre démarche a été sauvegardée") => { const isNewDeclaration = !payload.value.id const url = isNewDeclaration ? `/api/v1/users/${loggedUser.value.id}/declarations/` @@ -225,7 +225,7 @@ const savePayload = async () => { useToaster().addMessage({ type: "success", id: "declaration-success", - description: "Votre démarche a été sauvegardée", + description: successMessage, }) return true }