household address: patch address + add validFrom input

This commit is contained in:
nobohan
2021-06-08 21:14:09 +02:00
parent db77224b9f
commit 9375c2cf86
4 changed files with 67 additions and 5 deletions

View File

@@ -82,10 +82,37 @@ const postAddress = (address) => {
});
};
/*
* Endpoint chill_api_single_address__entity__create
* method PATCH, patch Address Instance
*
* @id integer - id of address
* @body Object - dictionary with changes to post
*/
const patchAddress = (id, body) => {
console.log('body', body);
const url = `/api/1.0/main/address/${id}.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 {
fetchCountries,
fetchCities,
fetchReferenceAddresses,
fetchAddresses,
postAddress
postAddress,
patchAddress
};