From 4d4662a634f568cb033e9c7fbed9b6cbccc9890d Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Wed, 13 Oct 2021 19:31:48 +0200 Subject: [PATCH] adding endpoint for LocationType. fetch types and add form fields. --- .../Resources/public/vuejs/Activity/api.js | 15 ++++- .../vuejs/Activity/components/Location.vue | 2 + .../components/Location/NewLocation.vue | 55 +++++++++++++++++-- .../ChillMainExtension.php | 21 +++++++ .../ChillMainBundle/chill.api.specs.yaml | 11 ++++ 5 files changed, 98 insertions(+), 6 deletions(-) diff --git a/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/api.js b/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/api.js index f61587de4..af8875f0d 100644 --- a/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/api.js +++ b/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/api.js @@ -24,8 +24,21 @@ const getLocations = () => { }); }; +/* +* Load Location Types + */ +const getLocationTypes = () => { + const url = `/api/1.0/main/location-type.json`; + return fetch(url) + .then(response => { + if (response.ok) { return response.json(); } + throw Error('Error with request resource response'); + }); +}; + export { getSocialIssues, getSocialActionByIssue, - getLocations + getLocations, + getLocationTypes }; diff --git a/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/components/Location.vue b/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/components/Location.vue index 6ee4ba669..f042983e1 100644 --- a/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/components/Location.vue +++ b/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/components/Location.vue @@ -8,9 +8,11 @@