mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
household address: post address to household (WIP)
This commit is contained in:
parent
d513be2fce
commit
6f68349f57
@ -525,13 +525,13 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac
|
||||
'methods' => [
|
||||
Request::METHOD_GET => true,
|
||||
Request::METHOD_HEAD => true,
|
||||
Request::METHOD_POST=> true,
|
||||
],
|
||||
],
|
||||
'_entity' => [
|
||||
'methods' => [
|
||||
Request::METHOD_GET => true,
|
||||
Request::METHOD_HEAD => true
|
||||
Request::METHOD_HEAD => true,
|
||||
Request::METHOD_POST=> true,
|
||||
]
|
||||
],
|
||||
]
|
||||
|
@ -8,9 +8,6 @@
|
||||
<add-address
|
||||
@addNewAddress="addNewAddress">
|
||||
</add-address>
|
||||
<!-- <add-address-to-household
|
||||
@addAddressToHousehold="addAddressToHousehold">
|
||||
</add-address-to-household> -->
|
||||
<button class="sc-button bt-create centered mt-4" @click="addToHousehold">
|
||||
{{ $t('add_an_address_to_household') }}
|
||||
</button>
|
||||
@ -19,13 +16,11 @@
|
||||
<script>
|
||||
|
||||
import AddAddress from 'ChillMainAssets/vuejs/_components/AddAddress.vue';
|
||||
//import AddAddressToHousehold from './components/AddAddressToHousehold.vue'; //TODO keep this?
|
||||
|
||||
export default {
|
||||
name: 'App',
|
||||
components: {
|
||||
AddAddress,
|
||||
//AddAddressToHousehold
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@ -64,11 +59,11 @@ export default {
|
||||
},
|
||||
addToHousehold() {
|
||||
const householdId = this.householdId;
|
||||
const address = this.$store.state.address;
|
||||
const addressId = this.$store.state.address.address_id;
|
||||
console.log(householdId);
|
||||
console.log(address);
|
||||
console.log(addressId);
|
||||
|
||||
this.$store.dispatch('addAddressToHousehold', {householdId, address});
|
||||
this.$store.dispatch('addAddressToHousehold', {householdId, addressId});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -5,10 +5,11 @@
|
||||
* @id integer - id of household
|
||||
* @body Object - dictionary with changes to post
|
||||
*/
|
||||
export const postAddressToHousehold = (id, body) => {
|
||||
console.log(id);
|
||||
console.log(body);
|
||||
const url = `/api/1.0/person/household/${id}.json`
|
||||
export const postAddressToHousehold = (householdId, addressId) => {
|
||||
console.log(householdId);
|
||||
console.log(addressId);
|
||||
const body = {'address': addressId};
|
||||
const url = `/api/1.0/person/household/${householdId}.json`
|
||||
return fetch(url, {
|
||||
method: 'POST',
|
||||
headers: {'Content-Type': 'application/json;charset=utf-8'},
|
||||
|
@ -1,31 +0,0 @@
|
||||
<template>
|
||||
<button class="sc-button bt-create centered mt-4" @click="postToHousehold">
|
||||
{{ $t('add_an_address_to_household') }}
|
||||
</button>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
|
||||
export default {
|
||||
name: 'AddAddressToHousehold',
|
||||
components: {
|
||||
},
|
||||
props: [
|
||||
],
|
||||
//emits: ['addNewAddress'],
|
||||
data() {
|
||||
return {
|
||||
household: {
|
||||
}, //TODO needed?
|
||||
errorMsg: {}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
postToHousehold() {
|
||||
//TODO
|
||||
console.log('click btn add_an_address_to_household')
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
@ -44,7 +44,7 @@ const store = createStore({
|
||||
addAddressToHousehold({ commit }, payload) {
|
||||
console.log('@A addAddressToHousehold payload', payload);
|
||||
|
||||
postAddressToHousehold(payload.householdId, payload.address)
|
||||
postAddressToHousehold(payload.householdId, payload.addressId)
|
||||
.then(household => new Promise((resolve, reject) => {
|
||||
commit('addAddressToHousehold', household);
|
||||
resolve();
|
||||
|
Loading…
x
Reference in New Issue
Block a user