From 355c5cf8fd52ec96ebc472c08538c5ba2093463e Mon Sep 17 00:00:00 2001 From: nobohan Date: Tue, 19 Apr 2022 09:54:42 +0200 Subject: [PATCH] person: add address when creating person in AddPerson: fix POSTing household --- .../public/vuejs/_components/AddPersons.vue | 21 +++++++++---------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons.vue index 5e57ae93d..3c1cd52b1 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons.vue @@ -291,13 +291,10 @@ export default { 'type': 'household' }; const address = { - 'type': 'address', 'id': data.addressId }; makeFetch('POST', '/api/1.0/person/household.json', household) .then(responseHousehold => { - console.log(responseHousehold); - const member = { 'concerned': [ { @@ -305,25 +302,27 @@ export default { 'type': 'person', 'id': responsePerson.id }, - "position": { + 'position': { "type": "household_position", "id": 4 //TODO, which position? }, + 'start_date': { + 'datetime': `${new Date().toISOString().split('T')[0]}T00:00:00+02:00` + }, + 'holder': false, //TODO true or false? + 'comment': null } ], 'destination': { 'type': 'household', 'id': responseHousehold.id - } + }, + 'composition': null }; - console.log(member); makeFetch('POST', '/api/1.0/person/household/members/move.json', member) - .then(response => { - console.log(response); + .then(_response => { makeFetch('POST', `/api/1.0/person/household/${responseHousehold.id}/address.json`, address) - .then(response => { - console.log(response); - }) + .then(_response => {}) .catch((error) => { if (error.name === 'ValidationException') { for (let v of error.violations) {