mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
vue AddAddress: merge api files in the person bundle
This commit is contained in:
parent
c302452e01
commit
4b69f97e2f
@ -121,8 +121,7 @@
|
||||
<script>
|
||||
import Modal from 'ChillMainAssets/vuejs/_components/Modal';
|
||||
import { getAddress, fetchCountries, fetchCities, fetchReferenceAddresses, patchAddress, postAddress, postPostalCode } from '../api';
|
||||
import { postAddressToPerson } from "ChillPersonAssets/vuejs/_api/AddAddress/Person.js";
|
||||
import { postAddressToHousehold } from "ChillPersonAssets/vuejs/_api/AddAddress/Household.js";
|
||||
import { postAddressToPerson, postAddressToHousehold } from "ChillPersonAssets/vuejs/_api/AddAddress.js";
|
||||
import ShowAddress from './ShowAddress.vue';
|
||||
import EditAddress from './EditAddress.vue';
|
||||
|
||||
|
@ -24,4 +24,28 @@ const postAddressToPerson = (personId, addressId) => {
|
||||
});
|
||||
};
|
||||
|
||||
export { postAddressToPerson };
|
||||
/*
|
||||
* Endpoint household
|
||||
* method POST, post Household instance
|
||||
*
|
||||
* @id integer - id of household
|
||||
* @body Object - dictionary with changes to post
|
||||
*/
|
||||
const postAddressToHousehold = (householdId, addressId) => {
|
||||
const body = {
|
||||
'id': addressId
|
||||
};
|
||||
const url = `/api/1.0/person/household/${householdId}/address.json`
|
||||
return fetch(url, {
|
||||
method: 'POST',
|
||||
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 };
|
@ -1,23 +0,0 @@
|
||||
/*
|
||||
* Endpoint household
|
||||
* method POST, post Household instance
|
||||
*
|
||||
* @id integer - id of household
|
||||
* @body Object - dictionary with changes to post
|
||||
*/
|
||||
export const postAddressToHousehold = (householdId, addressId) => {
|
||||
const body = {
|
||||
'id': addressId
|
||||
};
|
||||
const url = `/api/1.0/person/household/${householdId}/address.json`
|
||||
return fetch(url, {
|
||||
method: 'POST',
|
||||
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');
|
||||
});
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user