refactor: revamp the importers & exporters systems to be reused (#3425)

Co-authored-by: jamesgeorge007 <jamesgeorge998001@gmail.com>
This commit is contained in:
Akash K
2023-12-06 21:24:29 +05:30
committed by GitHub
parent d9c75ed79e
commit ab7c29d228
90 changed files with 2399 additions and 1892 deletions

View File

@@ -339,7 +339,7 @@ const deleteBodyParam = (index: number) => {
}
workingParams.value = workingParams.value.filter(
(_, arrIndex) => arrIndex != index
(_, arrIndex) => arrIndex !== index
)
}

View File

@@ -214,10 +214,9 @@ const requestCode = computed(() => {
if (O.isSome(result)) {
errorState.value = false
return result.value
} else {
errorState.value = true
return ""
}
errorState.value = true
return ""
})
// Template refs

View File

@@ -126,19 +126,19 @@ const linewrapEnabled = ref(true)
const rawBodyParameters = ref<any | null>(null)
const codemirrorValue: Ref<string | undefined> =
typeof rawParamsBody.value == "string"
typeof rawParamsBody.value === "string"
? ref(rawParamsBody.value)
: ref(undefined)
watch(rawParamsBody, (newVal) => {
typeof newVal == "string"
typeof newVal === "string"
? (codemirrorValue.value = newVal)
: (codemirrorValue.value = undefined)
})
// propagate the edits from codemirror back to the body
watch(codemirrorValue, (updatedValue) => {
if (updatedValue && updatedValue != rawParamsBody.value) {
if (updatedValue && updatedValue !== rawParamsBody.value) {
rawParamsBody.value = updatedValue
}
})
@@ -185,7 +185,7 @@ const prettifyRequestBody = () => {
if (body.value.contentType.endsWith("json")) {
const jsonObj = JSON.parse(rawParamsBody.value as string)
prettifyBody = JSON.stringify(jsonObj, null, 2)
} else if (body.value.contentType == "application/xml") {
} else if (body.value.contentType === "application/xml") {
prettifyBody = prettifyXML(rawParamsBody.value as string)
}
rawParamsBody.value = prettifyBody

View File

@@ -242,7 +242,7 @@ const urlEncodedParamsRaw = pluckRef(body, "body")
const urlEncodedParams = computed<RawKeyValueEntry[]>({
get() {
return typeof urlEncodedParamsRaw.value == "string"
return typeof urlEncodedParamsRaw.value === "string"
? parseRawKeyValueEntries(urlEncodedParamsRaw.value)
: []
},