diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons.vue index 0aa1bb1d7..1cf6b4b0b 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons.vue @@ -92,8 +92,6 @@ import OnTheFly from 'ChillMainAssets/vuejs/OnTheFly/components/OnTheFly.vue'; import PersonSuggestion from './AddPersons/PersonSuggestion'; import { searchEntities } from 'ChillPersonAssets/vuejs/_api/AddPersons'; import { makeFetch } from 'ChillMainAssets/lib/api/apiMethods'; -import { postPerson } from "ChillPersonAssets/vuejs/_api/OnTheFly"; -import { postThirdparty } from "ChillThirdPartyAssets/vuejs/_api/OnTheFly"; export default { name: 'AddPersons', @@ -273,7 +271,6 @@ export default { this.newPriorSuggestion(response); }) .catch((error) => { - //commit('catchError', error); if (error.name === 'ValidationException') { for (let v of error.violations) { this.$toast.open({message: v }); @@ -284,13 +281,19 @@ export default { }) } else if (type === 'thirdparty') { - console.log('type thirdparty with', data); - postThirdparty(data) - .then(thirdparty => new Promise((resolve, reject) => { - console.log('onthefly create: post thirdparty', thirdparty); - this.newPriorSuggestion(thirdparty); - resolve(); - })); + makeFetch('POST', '/api/1.0/thirdparty/thirdparty.json', data) + .then(response => { + this.newPriorSuggestion(response); + }) + .catch((error) => { + if (error.name === 'ValidationException') { + for (let v of error.violations) { + this.$toast.open({message: v }); + } + } else { + this.$toast.open({message: 'An error occurred'}); + } + }) } } },