mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-21 23:23:51 +00:00
Merge branch 'address_refactoring' into add-location-period
This commit is contained in:
@@ -48,4 +48,32 @@ const postAddressToHousehold = (householdId, addressId) => {
|
||||
};
|
||||
|
||||
|
||||
export { postAddressToPerson, postAddressToHousehold };
|
||||
/*
|
||||
* Endpoint AccompanyingPeriod
|
||||
* method POST, post AccompanyingPeriod AddressLocation (temporary address)
|
||||
*
|
||||
* @id integer - id of AccompanyingPeriod
|
||||
* @body Object - dictionary with changes to post
|
||||
*/
|
||||
const patchAddressToAccompanyingPeriod = (accompanyingPeriodId, addressId) => {
|
||||
const body = {
|
||||
'type': 'accompanying_period',
|
||||
'id': accompanyingPeriodId,
|
||||
'personLocation': null,
|
||||
'addressLocation': {
|
||||
'id': addressId
|
||||
}
|
||||
};
|
||||
const url = `/api/1.0/person/accompanying-course/${accompanyingPeriodId}.json`;
|
||||
return fetch (url, {
|
||||
method: 'PATCH',
|
||||
headers: {'Content-Type': 'application/json;charset=utf-8'},
|
||||
body: JSON.stringify(body)
|
||||
})
|
||||
.then(response => {
|
||||
if (response.ok) { return response.json(); }
|
||||
throw Error('Error with request resource response');
|
||||
});
|
||||
};
|
||||
|
||||
export { postAddressToPerson, postAddressToHousehold, patchAddressToAccompanyingPeriod };
|
||||
|
Reference in New Issue
Block a user