mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-20 14:43:49 +00:00
move postPerson fetch method out of OnTheFly component for addPersons create person case
OnTheFly don't use store anymore, but addPerson still use it
This commit is contained in:
@@ -14,7 +14,6 @@
|
||||
|
||||
<template v-slot:header>
|
||||
<h3 class="modal-title">{{ $t(titleModal) }}</h3>
|
||||
type: {{type}}
|
||||
</template>
|
||||
|
||||
<template v-slot:body v-if="type === 'person'">
|
||||
@@ -65,7 +64,6 @@ import Modal from 'ChillMainAssets/vuejs/_components/Modal.vue';
|
||||
import OnTheFlyCreate from './OnTheFly/Create.vue';
|
||||
import OnTheFlyPerson from 'ChillPersonAssets/vuejs/_components/OnTheFly/Person.vue';
|
||||
import OnTheFlyThirdparty from 'ChillThirdPartyAssets/vuejs/_components/OnTheFly/ThirdParty.vue';
|
||||
import { postPerson } from "ChillPersonAssets/vuejs/_api/OnTheFly";
|
||||
|
||||
export default {
|
||||
name: 'OnTheFly',
|
||||
@@ -76,6 +74,7 @@ export default {
|
||||
OnTheFlyCreate
|
||||
},
|
||||
props: ['type', 'id', 'action', 'buttonText'],
|
||||
emits: ['saveFormOnTheFly'],
|
||||
data() {
|
||||
return {
|
||||
modal: {
|
||||
@@ -169,29 +168,10 @@ export default {
|
||||
}
|
||||
}
|
||||
|
||||
// create/edit person
|
||||
if (type === 'person') {
|
||||
|
||||
console.log('type person with', data);
|
||||
postPerson(data)
|
||||
.then(person => new Promise((resolve, reject) => {
|
||||
this.person = person;
|
||||
this.$store.commit('newPriorSuggestion', person);
|
||||
resolve();
|
||||
}));
|
||||
}
|
||||
|
||||
// create/edit thirdparty
|
||||
else if (type === 'thirdparty') {
|
||||
|
||||
console.log('not yet implemented', type);
|
||||
console.log('type thirdparty with', data);
|
||||
// postThirdparty(data)
|
||||
// .then(...)
|
||||
}
|
||||
// pass datas to parent
|
||||
this.$emit('saveFormOnTheFly', { type: type, data: data });
|
||||
|
||||
this.modal.showModal = false;
|
||||
|
||||
},
|
||||
goToLocation(id, type){
|
||||
if(type == 'person'){
|
||||
|
Reference in New Issue
Block a user