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/functions/templating.js b/functions/templating.js index 68d009cfd..b83e808e2 100644 --- a/functions/templating.js +++ b/functions/templating.js @@ -3,5 +3,5 @@ export default function parseTemplateString(string, variables) { return string } const searchTerm = /<<([^>]*)>>/g // "<>" - return string.replace(searchTerm, (match, p1) => variables[p1] || "") + return decodeURI(string).replace(searchTerm, (match, p1) => variables[p1] || "") } diff --git a/pages/index.vue b/pages/index.vue index 4fbeaddbd..e07093356 100644 --- a/pages/index.vue +++ b/pages/index.vue @@ -848,6 +848,22 @@ " /> +
  • + + + +