Display of toasts for accompanying course + general makeFetch

This commit is contained in:
LenaertsJ 2021-11-29 12:39:11 +00:00 committed by Julien Fastré
parent 02a8c1ae10
commit d5a269356b
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'})
} }
}); });
}, },