FIX [referrer][deselect] allow referrer to be deselected in parcours edit form

This commit is contained in:
Julie Lenaerts 2023-03-13 16:41:43 +01:00
parent 896b4cdfe3
commit 4a30f310b8

View File

@ -59,6 +59,7 @@
:placeholder="$t('referrer.placeholder')" :placeholder="$t('referrer.placeholder')"
v-model="value" v-model="value"
@select="updateReferrer" @select="updateReferrer"
@remove="removeReferrer"
:options="users" :options="users"
:select-label="$t('multiselect.select_label')" :select-label="$t('multiselect.select_label')"
:deselect-label="$t('multiselect.deselect_label')" :deselect-label="$t('multiselect.deselect_label')"
@ -194,6 +195,17 @@ export default {
}); });
this.toggleModal() this.toggleModal()
}, },
removeReferrer() {
console.log('remove option')
this.$store.dispatch('updateReferrer', null)
.catch(({name, violations}) => {
if (name === 'ValidationException' || name === 'AccessException') {
violations.forEach((violation) => this.$toast.open({message: violation}));
} else {
this.$toast.open({message: 'An error occurred'})
}
});
},
cancelChange() { cancelChange() {
this.value = this.$store.state.accompanyingCourse.user this.value = this.$store.state.accompanyingCourse.user
this.toggleModal() this.toggleModal()