feat: input toggle for parameters and headers (#1388)

* feat: toggler for parameters and headers

* refactor: move bodyParams to separate component + feat: input toggle

* fix: backward copaitability

* Fixed issue with imported active prop mutations

Co-authored-by: Andrew Bastin <andrewbastin.k@gmail.com>
This commit is contained in:
Liyas Thomas
2020-12-28 06:02:41 +05:30
committed by GitHub
parent 353978f115
commit 71170a1c5d
7 changed files with 242 additions and 112 deletions

View File

@@ -1,9 +1,12 @@
export function hasPathParams(params) {
return params.some(({ type }) => type === "path")
return params
.filter((item) => (item.hasOwnProperty("active") ? item.active == true : true))
.some(({ type }) => type === "path")
}
export function addPathParamsToVariables(params, variables) {
params
.filter((item) => (item.hasOwnProperty("active") ? item.active == true : true))
.filter(({ key }) => !!key)
.filter(({ type }) => type === "path")
.forEach(({ key, value }) => (variables[key] = value))
@@ -11,5 +14,8 @@ export function addPathParamsToVariables(params, variables) {
}
export function getQueryParams(params) {
return params.filter(({ key }) => !!key).filter(({ type }) => type != "path")
return params
.filter((item) => (item.hasOwnProperty("active") ? item.active == true : true))
.filter(({ key }) => !!key)
.filter(({ type }) => type != "path")
}