mirror of
				https://gitlab.com/Chill-Projet/chill-bundles.git
				synced 2025-11-04 03:08:25 +00:00 
			
		
		
		
	Merge branch 'address_refactoring' into add-location-period
This commit is contained in:
		@@ -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');
 | 
			
		||||
      });
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user