mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-21 15:13:50 +00:00
throw 403 error instead of 422 and display toast message
This commit is contained in:
@@ -58,7 +58,7 @@ export default {
|
||||
this.$store.dispatch('toggleIntensity', value)
|
||||
.catch(({name, violations}) => {
|
||||
if (name === 'ValidationException' || name === 'AccessException') {
|
||||
violations.forEach((violation) => this.$toast.open({message: this.$t(violation)}));
|
||||
this.$toast.open({message: this.$t('Only the referrer can toggle the intensity of an accompanying course')})
|
||||
} else {
|
||||
this.$toast.open({message: 'An error occurred'})
|
||||
}
|
||||
@@ -75,16 +75,11 @@ export default {
|
||||
});
|
||||
},
|
||||
toggleConfidential() {
|
||||
this.$store.dispatch('fetchPermissions').then(() => {
|
||||
if (!this.$store.getters.canTogglePermission) {
|
||||
this.$toast.open({message: "Seul le référent peut modifier la confidentialité"});
|
||||
return Promise.resolve();
|
||||
} else {
|
||||
return this.$store.dispatch('toggleConfidential', (!this.isConfidential));
|
||||
}
|
||||
}).catch(({name, violations}) => {
|
||||
this.$store.dispatch('toggleConfidential')
|
||||
.catch(({name, violations}) => {
|
||||
console.log(name);
|
||||
if (name === 'ValidationException' || name === 'AccessException') {
|
||||
violations.forEach((violation) => this.$toast.open({message: violation}));
|
||||
this.$toast.open({message: this.$t('Only the referrer can toggle the confidentiality of an accompanying course')})
|
||||
} else {
|
||||
this.$toast.open({message: 'An error occurred'})
|
||||
}
|
||||
|
@@ -167,7 +167,8 @@ const appMessages = {
|
||||
'Error while retriving users.': "Erreur du serveur lors du chargement de la liste des travailleurs.",
|
||||
'Error while getting whoami.': "Erreur du serveur lors de la requête 'qui suis-je ?'",
|
||||
'Error while retriving origin\'s list.': "Erreur du serveur lors du chargement de la liste des origines de la demande.",
|
||||
'Only the referrer is allowed to change the intensity of a parcours': "Seul le référent peut modifier l'intensité d'un parcours."
|
||||
'Only the referrer can toggle the intensity of an accompanying course': "Seul le référent peut modifier l'intensité d'un parcours.",
|
||||
'Only the referrer can toggle the confidentiality of an accompanying course': "Seul le référent peut modifier la confidentialité d'un parcours."
|
||||
}
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user