From 820def6294073f09bfd7b49ad49787d0935ed9ca Mon Sep 17 00:00:00 2001
From: Julie Lenaerts
Date: Wed, 1 Sep 2021 17:35:11 +0200
Subject: [PATCH] make onTheFly with API call
---
.../Resources/public/vuejs/_api/OnTheFly.js | 36 ++++++++++++++
.../Entity/ThirdPartyRenderBox.vue | 6 +--
.../vuejs/_components/OnTheFly/ThirdParty.vue | 49 +++++++++++++++----
3 files changed, 79 insertions(+), 12 deletions(-)
create mode 100644 src/Bundle/ChillThirdPartyBundle/Resources/public/vuejs/_api/OnTheFly.js
diff --git a/src/Bundle/ChillThirdPartyBundle/Resources/public/vuejs/_api/OnTheFly.js b/src/Bundle/ChillThirdPartyBundle/Resources/public/vuejs/_api/OnTheFly.js
new file mode 100644
index 000000000..ed91ef415
--- /dev/null
+++ b/src/Bundle/ChillThirdPartyBundle/Resources/public/vuejs/_api/OnTheFly.js
@@ -0,0 +1,36 @@
+/*
+* GET a thirdparty by id
+*/
+const getThirdparty = (id) => {
+ const url = `/api/1.0/thirdparty/thirdparty/${id}.json`;
+ return fetch(url)
+ .then(response => {
+ if (response.ok) {
+ return response.json();
+ }
+ throw Error('Error with request resource response');
+ });
+};
+
+/*
+* POST a new person
+*/
+const postThirdparty = (body) => {
+ const url = `/api/1.0/thirdparty/thirdparty.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 {
+ getThirdparty,
+ postThirdparty
+};
\ No newline at end of file
diff --git a/src/Bundle/ChillThirdPartyBundle/Resources/public/vuejs/_components/Entity/ThirdPartyRenderBox.vue b/src/Bundle/ChillThirdPartyBundle/Resources/public/vuejs/_components/Entity/ThirdPartyRenderBox.vue
index 7f21e3379..a5142b9e6 100644
--- a/src/Bundle/ChillThirdPartyBundle/Resources/public/vuejs/_components/Entity/ThirdPartyRenderBox.vue
+++ b/src/Bundle/ChillThirdPartyBundle/Resources/public/vuejs/_components/Entity/ThirdPartyRenderBox.vue
@@ -26,7 +26,7 @@
- {{ thirdparty.age }}
+ {{ thirdparty.age }}
@@ -37,9 +37,9 @@
-
+
- {{ thirdparty.telephone }}
+ {{ thirdparty.phonenumber }}
diff --git a/src/Bundle/ChillThirdPartyBundle/Resources/public/vuejs/_components/OnTheFly/ThirdParty.vue b/src/Bundle/ChillThirdPartyBundle/Resources/public/vuejs/_components/OnTheFly/ThirdParty.vue
index a681952a7..b23121c56 100644
--- a/src/Bundle/ChillThirdPartyBundle/Resources/public/vuejs/_components/OnTheFly/ThirdParty.vue
+++ b/src/Bundle/ChillThirdPartyBundle/Resources/public/vuejs/_components/OnTheFly/ThirdParty.vue
@@ -9,6 +9,7 @@
addAltNames: true,
addId: true,
addLink: false,
+ addAge: false,
hLevel: 3,
addCenter: true,
addNoData: true,
@@ -40,7 +41,7 @@
@@ -50,7 +51,8 @@
-