mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
person: add address when creating person in AddPerson: fix POSTing household
This commit is contained in:
parent
57ed90a696
commit
355c5cf8fd
@ -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) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user