From e14a125bf378d805ca91c41725d6d7001e863b09 Mon Sep 17 00:00:00 2001 From: nobohan Date: Wed, 9 Jun 2021 12:24:15 +0200 Subject: [PATCH] household address: format js date for POSTing --- .../public/vuejs/HouseholdAddress/App.vue | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdAddress/App.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdAddress/App.vue index 2dcabcd9d..a194b092e 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdAddress/App.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdAddress/App.vue @@ -82,15 +82,21 @@ export default { modal.showModal = false; }, addToHousehold() { - const householdId = this.householdId; - const addressId = this.$store.state.newAddress.address_id; - console.log(householdId); - console.log(addressId); + const householdId = this.householdId; + const addressId = this.$store.state.newAddress.address_id; + console.log(householdId); + console.log(addressId); + console.log(this.validFrom) + // TODO: Chainer l'ajout de la date puis l'ajout de l'addresse au ménage + this.$store.dispatch('addDateToAddress', { + addressId, + body: { + validFrom: {datetime: `${this.validFrom}T00:00:00+0100`} + } + } + ); + this.$store.dispatch('addAddressToHousehold', {householdId, addressId}); - this.$store.dispatch('addAddressToHousehold', {householdId, addressId}); - - // let response = patchAddress(addressId, {floor: 'danzfloor'}); //works - this.$store.dispatch('addDateToAddress', {addressId, body: {validFrom: this.validFrom}}); //TODO format validfrom {"type":"https:\/\/tools.ietf.org\/html\/rfc2616#section-10","title":"An error occurred","status":500,"detail":"Warning: Illegal string offset 'datetime'","class":"ErrorException","trace":[{"namespace":"","short_class":"","class":"","type":"","function":"","file":"\/var\/www\/app\/vendor\/chill-project\/chill-bundles\/src\/Bundle\/ChillMainBundle\/Serializer\/Normalizer\/DateNormalizer.php","line":45,"args":[]},{"namespace":"Chill\\MainBundle\\Serializer\\Normalizer","short_class":"DateNormalizer","class":"Chill\\MainBundle\\Serializer\\Normalizer\\DateNormalizer","type":"->","function":"denormalize","file":"\/var\/www\/app\/vendor\/symfony\/serializer\/Serializer.php","line":208,"args":[["string","2021-06-10"],["string","DateTime"],["string","json"],["array",{"groups":["array",[["string","write"]]],"cache_key":["string","5d4795711484167f76225de0d23d05ce"]}]]},{"namespace":"Symfony\\Component\\Serializer","short_class":"Serializer","class":"Symfony\\Component\\Serializer\\Serializer","type":"->","function":"denormalize","file":"\/var\/www\/app\/vendor\/symfony\/serializer\/Normalizer\/AbstractObjectNormalizer.php","line":471,"args":[["string","2021-06-10"],["string","DateTime"],["string","json"],["array",{"groups":["array",[["string","write"]]],"cache_key":["string","5d4795711484167f76225de0d23d05ce"]}]]},{"namespace":"Symfony\\Component\\Serializer\\Normalizer","short_class":"AbstractObjectNormalizer","class":"Symfony\\Component\\Serializer\\Normalizer\\AbstractObjectNormalizer","type":"->","function":"validateAndDenormalize","file":"\/var\/www\/app\/vendor\/symfony\/serializer\/Normalizer\/AbstractObjectNormalizer.php","line":334,"args":[["string","Chill\\MainBundle\\Entity\\Address"],["string","validFrom"],["string","2021-06-10"],["string","json"],["array",{"groups":["array",[["string","write"]]],"cache_key":["string","5d4795711484167f76225de0d23d05ce"]}]]},{"namespace":"Symfony\\Component\\Serializer\\Normalizer","short_class":"AbstractObjectNormalizer","class":"Symfony\\Component\\Serializer\\Normalizer\\AbstractObjectNormalizer","type":"->","function":"denormalize","file":"\/var\/www\/app\/vendor\/symfony\/serializer\/Serializer.php","line":208,"args":[["array",{"validFrom":["string","2021-06-10"]}],["string","Chill\\MainBundle\\Entity\\Address"],["string","json"],["array",{"groups":["array",[["string","write"]]],"cache_key":["string","5d4795711484167f76225de0d23d05ce"]}]]},{"namespace":"Symfony\\Component\\Serializer","short_class":"Serializer","class":"Symfony\\Component\\Serializer\\Serializer","type":"->","function":"denormalize","file":"\/var\/www\/app\/vendor\/symfony\/serializer\/Serializer.php","line":144,"args":[["array",{"validFrom":["string","2021-06-10"]}],["string","Chill\\MainBundle\\Entity\\Address"],["string","json"],["array",{"object_to_populate":["object","Chill\\MainBundle\\Entity\\Address"],"groups":["array",[["string","write"]]]}]]},{"namespace":"Symfony\\Component\\Serializer","short_class":"Serializer","class":"Symfony\\Component\\Serializer\\Serializer","type":"->","function":"deserialize","file":"\/var\/www\/app\/vendor\/chill-project\/chill-bundles\/src\/Bundle\/ChillMainBundle\/CRUD\/Controller\/ApiController.php","line":260,"args":[["array",{"validFrom":["string","2021-06-10"]}],["string","Chill\\MainBundle\\Entity\\Address"],["string","json"],["array",{"object_to_populate":["object","Chill\\MainBundle\\Entity\\Address"],"groups":["array",[["string","write"]]]}]]},{"namespace":"Chill\\MainBundle\\CRUD\\Controller","short_class":"ApiController","class":"Chill\\MainBundle\\CRUD\\Controller\\ApiController","type":"->","function":"deserialize","file":"\/var\/www\/app\/vendor\/chill-project\/chill-bundles\/src\/Bundle\/ChillMainBundle\/CRUD\/Controller\/ApiController.php","line":187,"args":[["string","_entity"],["object","Symfony\\Component\\HttpFoundation\\Request"],["string","json"],["object","Chill\\MainBundle\\Entity\\Address"]]},{"namespace":"Chill\\MainBundle\\CRUD\\Controller","short_class":"ApiController","class":"Chill\\MainBundle\\CRUD\\Controller\\ApiController","type":"->","function":"entityPut","file":"\/var\/www\/app\/vendor\/chill-project\/chill-bundles\/src\/Bundle\/ChillMainBundle\/CRUD\/Controller\/ApiController.php","line":87,"args":[["string","_entity"],["object","Symfony\\Component\\HttpFoundation\\Request"],["string","574"],["string","json"]]},{"namespace":"Chill\\MainBundle\\CRUD\\Controller","short_class":"ApiController","class":"Chill\\MainBundle\\CRUD\\Controller\\ApiController","type":"->","function":"entityApi","file":"\/var\/www\/app\/vendor\/symfony\/http-kernel\/HttpKernel.php","line":158,"args":[["object","Symfony\\Component\\HttpFoundation\\Request"],["string","574"],["string","json"]]},{"namespace":"Symfony\\Component\\HttpKernel","short_class":"HttpKernel","class":"Symfony\\Component\\HttpKernel\\HttpKernel","type":"->","function":"handleRaw","file":"\/var\/www\/app\/vendor\/symfony\/http-kernel\/HttpKernel.php","line":80,"args":[["object","Symfony\\Component\\HttpFoundation\\Request"],["integer",1]]},{"namespace":"Symfony\\Component\\HttpKernel","short_class":"HttpKernel","class":"Symfony\\Component\\HttpKernel\\HttpKernel","type":"->","function":"handle","file":"\/var\/www\/app\/vendor\/symfony\/http-kernel\/Kernel.php","line":201,"args":[["object","Symfony\\Component\\HttpFoundation\\Request"],["integer",1],["boolean",true]]},{"namespace":"Symfony\\Component\\HttpKernel","short_class":"Kernel","class":"Symfony\\Component\\HttpKernel\\Kernel","type":"->","function":"handle","file":"\/var\/www\/app\/public\/index.php","line":25,"args":[["object","Symfony\\Component\\HttpFoundation\\Request"]]}]} } } };