From 25f014ef3b34216068193bad5b2e899cea39fda2 Mon Sep 17 00:00:00 2001 From: "Samir L. Boulema" Date: Sat, 2 May 2020 19:34:16 +0200 Subject: [PATCH 1/2] URL Path Parameters #834 --- functions/requestParams.js | 17 ++++++++++++++++ pages/index.vue | 40 ++++++++++++++++++++++++++++---------- store/mutations.js | 4 ++++ 3 files changed, 51 insertions(+), 10 deletions(-) create mode 100644 functions/requestParams.js diff --git a/functions/requestParams.js b/functions/requestParams.js new file mode 100644 index 000000000..80ea19821 --- /dev/null +++ b/functions/requestParams.js @@ -0,0 +1,17 @@ +export function hasPathParams(params) { + return params.some((p) => p.type === "path") +} + +export function addPathParamsToVariables(params, variables) { + params + .filter(({ key }) => !!key) + .filter(({ type }) => type === "path") + .forEach(p => variables[p.key] = p.value) + return variables; +} + +export function getQueryParams(params) { + return params + .filter(({ key }) => !!key) + .filter(({ type }) => type != "path") +} \ No newline at end of file diff --git a/pages/index.vue b/pages/index.vue index a523eae4e..c94dd2210 100644 --- a/pages/index.vue +++ b/pages/index.vue @@ -848,6 +848,22 @@ " /> +
  • + + + +