Refactoring Lenses Using Vue Composables (#1995)

This commit is contained in:
Rishabh Agarwal
2022-01-17 21:00:48 +05:30
committed by GitHub
parent ddff126aaa
commit 647c347eb1
10 changed files with 187 additions and 208 deletions

View File

@@ -16,7 +16,13 @@ export const lenses: Lens[] = [jsonLens, imageLens, htmlLens, xmlLens, rawLens]
export function getSuitableLenses(response: HoppRESTResponse): Lens[] {
// return empty array if response is loading or error
if (response.type === "loading" || response.type === "network_fail") return []
if (
response.type === "loading" ||
response.type === "network_fail" ||
response.type === "script_fail" ||
response.type === "fail"
)
return []
const contentType = response.headers.find((h) => h.key === "content-type")