mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
person: treat 422 error in AddPerson for thirdparty
This commit is contained in:
parent
8f6a70b240
commit
f1c61a2387
@ -92,8 +92,6 @@ import OnTheFly from 'ChillMainAssets/vuejs/OnTheFly/components/OnTheFly.vue';
|
|||||||
import PersonSuggestion from './AddPersons/PersonSuggestion';
|
import PersonSuggestion from './AddPersons/PersonSuggestion';
|
||||||
import { searchEntities } from 'ChillPersonAssets/vuejs/_api/AddPersons';
|
import { searchEntities } from 'ChillPersonAssets/vuejs/_api/AddPersons';
|
||||||
import { makeFetch } from 'ChillMainAssets/lib/api/apiMethods';
|
import { makeFetch } from 'ChillMainAssets/lib/api/apiMethods';
|
||||||
import { postPerson } from "ChillPersonAssets/vuejs/_api/OnTheFly";
|
|
||||||
import { postThirdparty } from "ChillThirdPartyAssets/vuejs/_api/OnTheFly";
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'AddPersons',
|
name: 'AddPersons',
|
||||||
@ -273,7 +271,6 @@ export default {
|
|||||||
this.newPriorSuggestion(response);
|
this.newPriorSuggestion(response);
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
//commit('catchError', error);
|
|
||||||
if (error.name === 'ValidationException') {
|
if (error.name === 'ValidationException') {
|
||||||
for (let v of error.violations) {
|
for (let v of error.violations) {
|
||||||
this.$toast.open({message: v });
|
this.$toast.open({message: v });
|
||||||
@ -284,13 +281,19 @@ export default {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
else if (type === 'thirdparty') {
|
else if (type === 'thirdparty') {
|
||||||
console.log('type thirdparty with', data);
|
makeFetch('POST', '/api/1.0/thirdparty/thirdparty.json', data)
|
||||||
postThirdparty(data)
|
.then(response => {
|
||||||
.then(thirdparty => new Promise((resolve, reject) => {
|
this.newPriorSuggestion(response);
|
||||||
console.log('onthefly create: post thirdparty', thirdparty);
|
})
|
||||||
this.newPriorSuggestion(thirdparty);
|
.catch((error) => {
|
||||||
resolve();
|
if (error.name === 'ValidationException') {
|
||||||
}));
|
for (let v of error.violations) {
|
||||||
|
this.$toast.open({message: v });
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.$toast.open({message: 'An error occurred'});
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user