mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-23 16:13:50 +00:00
person: add validation on relationship between person
This commit is contained in:
@@ -472,15 +472,25 @@ export default {
|
||||
|
||||
case 'create':
|
||||
return postRelationship(this.modal.data)
|
||||
.then(relationship => new Promise(resolve => {
|
||||
//console.log('post relationship response', relationship)
|
||||
this.$store.dispatch('addLinkFromRelationship', relationship)
|
||||
this.modal.showModal = false
|
||||
this.resetForm()
|
||||
this.forceUpdateComponent()
|
||||
resolve()
|
||||
}))
|
||||
.catch()
|
||||
.then(relationship => new Promise(resolve => {
|
||||
//console.log('post relationship response', relationship)
|
||||
this.$store.dispatch('addLinkFromRelationship', relationship)
|
||||
this.modal.showModal = false
|
||||
this.resetForm()
|
||||
this.forceUpdateComponent()
|
||||
resolve()
|
||||
}))
|
||||
.catch( error => {
|
||||
if (error.name === 'ValidationException') {
|
||||
for (let v of error.violations) {
|
||||
this.$toast.open({message: v });
|
||||
console.log(v)
|
||||
}
|
||||
} else {
|
||||
this.$toast.open({message: 'An error occurred'});
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
case 'edit':
|
||||
return patchRelationship(this.modal.data)
|
||||
|
Reference in New Issue
Block a user