URL Path Parameters #834

This commit is contained in:
Samir L. Boulema
2020-05-02 19:34:16 +02:00
parent 44cff354f2
commit 25f014ef3b
3 changed files with 51 additions and 10 deletions

View File

@@ -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")
}