Merge branch 'add_toasters' into 'master'

Display of toasts for accompanying course + general makeFetch

See merge request Chill-Projet/chill-bundles!221
This commit is contained in:
Julien Fastré 2021-11-29 12:39:11 +00:00
commit bd98e9cc9b
2 changed files with 9 additions and 3 deletions

View File

@ -48,7 +48,6 @@ const whoami = () => {
}); });
}; };
export { export {
whoami, whoami,
getSocialIssues, getSocialIssues,

View File

@ -78,8 +78,15 @@ export default {
this.$store.dispatch('fetchPermissions').then(() => { this.$store.dispatch('fetchPermissions').then(() => {
if (!this.$store.getters.canTogglePermission) { if (!this.$store.getters.canTogglePermission) {
this.$toast.open({message: "Seul le référent peut modifier la confidentialité"}); this.$toast.open({message: "Seul le référent peut modifier la confidentialité"});
return Promise.resolve();
} else { } else {
this.$store.dispatch('toggleConfidential', (!this.isConfidential)); return this.$store.dispatch('toggleConfidential', (!this.isConfidential));
}
}).catch(({name, violations}) => {
if (name === 'ValidationException' || name === 'AccessException') {
violations.forEach((violation) => this.$toast.open({message: violation}));
} else {
this.$toast.open({message: 'An error occurred'})
} }
}); });
}, },