mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-12 21:34:25 +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' => [
|
'methods' => [
|
||||||
Request::METHOD_GET => true,
|
Request::METHOD_GET => true,
|
||||||
Request::METHOD_HEAD => true,
|
Request::METHOD_HEAD => true,
|
||||||
Request::METHOD_POST=> true,
|
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'_entity' => [
|
'_entity' => [
|
||||||
'methods' => [
|
'methods' => [
|
||||||
Request::METHOD_GET => true,
|
Request::METHOD_GET => true,
|
||||||
Request::METHOD_HEAD => true
|
Request::METHOD_HEAD => true,
|
||||||
|
Request::METHOD_POST=> true,
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
]
|
]
|
||||||
|
@ -8,9 +8,6 @@
|
|||||||
<add-address
|
<add-address
|
||||||
@addNewAddress="addNewAddress">
|
@addNewAddress="addNewAddress">
|
||||||
</add-address>
|
</add-address>
|
||||||
<!-- <add-address-to-household
|
|
||||||
@addAddressToHousehold="addAddressToHousehold">
|
|
||||||
</add-address-to-household> -->
|
|
||||||
<button class="sc-button bt-create centered mt-4" @click="addToHousehold">
|
<button class="sc-button bt-create centered mt-4" @click="addToHousehold">
|
||||||
{{ $t('add_an_address_to_household') }}
|
{{ $t('add_an_address_to_household') }}
|
||||||
</button>
|
</button>
|
||||||
@ -19,13 +16,11 @@
|
|||||||
<script>
|
<script>
|
||||||
|
|
||||||
import AddAddress from 'ChillMainAssets/vuejs/_components/AddAddress.vue';
|
import AddAddress from 'ChillMainAssets/vuejs/_components/AddAddress.vue';
|
||||||
//import AddAddressToHousehold from './components/AddAddressToHousehold.vue'; //TODO keep this?
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'App',
|
name: 'App',
|
||||||
components: {
|
components: {
|
||||||
AddAddress,
|
AddAddress,
|
||||||
//AddAddressToHousehold
|
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@ -64,11 +59,11 @@ export default {
|
|||||||
},
|
},
|
||||||
addToHousehold() {
|
addToHousehold() {
|
||||||
const householdId = this.householdId;
|
const householdId = this.householdId;
|
||||||
const address = this.$store.state.address;
|
const addressId = this.$store.state.address.address_id;
|
||||||
console.log(householdId);
|
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
|
* @id integer - id of household
|
||||||
* @body Object - dictionary with changes to post
|
* @body Object - dictionary with changes to post
|
||||||
*/
|
*/
|
||||||
export const postAddressToHousehold = (id, body) => {
|
export const postAddressToHousehold = (householdId, addressId) => {
|
||||||
console.log(id);
|
console.log(householdId);
|
||||||
console.log(body);
|
console.log(addressId);
|
||||||
const url = `/api/1.0/person/household/${id}.json`
|
const body = {'address': addressId};
|
||||||
|
const url = `/api/1.0/person/household/${householdId}.json`
|
||||||
return fetch(url, {
|
return fetch(url, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {'Content-Type': 'application/json;charset=utf-8'},
|
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) {
|
addAddressToHousehold({ commit }, payload) {
|
||||||
console.log('@A addAddressToHousehold payload', payload);
|
console.log('@A addAddressToHousehold payload', payload);
|
||||||
|
|
||||||
postAddressToHousehold(payload.householdId, payload.address)
|
postAddressToHousehold(payload.householdId, payload.addressId)
|
||||||
.then(household => new Promise((resolve, reject) => {
|
.then(household => new Promise((resolve, reject) => {
|
||||||
commit('addAddressToHousehold', household);
|
commit('addAddressToHousehold', household);
|
||||||
resolve();
|
resolve();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user