Translate message on conflict in AccompanyingPeriodWorkEdit App

This commit is contained in:
Julien Fastré 2024-02-08 12:32:42 +01:00
parent aa0cadfa84
commit cc281762b3
Signed by: julienfastre
GPG Key ID: BDE2190974723FCB

View File

@ -351,6 +351,7 @@ const i18n = {
action: { action: {
save: "Enregistrer" save: "Enregistrer"
}, },
conflict_on_save: "Désolé, cette action d'accompagnement a été modifiée dans une autre fenêtre ou par un autre utilisateur. Rechargez la page pour voir ses changements.",
action_title: "Action d'accompagnement", action_title: "Action d'accompagnement",
comments: "Commentaire", comments: "Commentaire",
startDate: "Date de début", startDate: "Date de début",
@ -599,8 +600,10 @@ export default {
}, },
submit() { submit() {
this.$store.dispatch('submit').catch((error) => { this.$store.dispatch('submit').catch((error) => {
if (error.name === 'ValidationException' || error.name === 'AccessException' || error.name === 'ConflictHttpException') { if (error.name === 'ValidationException' || error.name === 'AccessException') {
error.violations.forEach((violation) => this.$toast.open({message: violation})); error.violations.forEach((violation) => this.$toast.open({message: violation}));
} else if (error.name === 'ConflictHttpException') {
this.$toast.open({message: this.$t('conflict_on_save')});
} else { } else {
this.$toast.open({message: 'An error occurred'}); this.$toast.open({message: 'An error occurred'});
throw error; throw error;
@ -626,8 +629,10 @@ export default {
for (let v of error.violations) { for (let v of error.violations) {
this.$toast.open({message: v }); this.$toast.open({message: v });
} }
} else if (error.name === 'ConflictHttpException') {
this.$toast.open({message: this.$t('conflict_on_save')});
} else { } else {
this.$toast.open({message: 'An error occurred'}); this.$toast.open({message: 'An error occurred'});
} }
}) })
}, },