Open-Source API Development Ecosystem • https://hoppscotch.io • Offline, On-Prem & Cloud • Web, Desktop & CLI • Open-Source Alternative to Postman, Insomnia
TypeScript apiapi-clientapi-restapi-testingdeveloper-toolsgraphqlhttphttp-clientpwarestrest-apispatestingtesting-toolstoolsvuevuejswebsocket
refactor: correct type error in useDownloadResponse
Andrew Bastin750487e8adac
diff --git a/packages/hoppscotch-app/helpers/lenses/composables/useDownloadResponse.ts b/packages/hoppscotch-app/helpers/lenses/composables/useDownloadResponse.tsindex acc357929..95a070169 100644--- a/packages/hoppscotch-app/helpers/lenses/composables/useDownloadResponse.ts+++ b/packages/hoppscotch-app/helpers/lenses/composables/useDownloadResponse.ts@@ -1,3 +1,6 @@+import * as S from "fp-ts/string"+import * as RNEA from "fp-ts/ReadonlyNonEmptyArray"+import { pipe } from "fp-ts/function"import { Ref, ref } from "@nuxtjs/composition-api"import { useI18n, useToast } from "~/helpers/utils/composables"@@ -20,8 +23,18 @@ export default function useDownloadResponse(const a = document.createElement("a")const url = URL.createObjectURL(file)a.href = url- // TODO get uri from meta- a.download = `${url.split("/").pop().split("#")[0].split("?")[0]}`++ // TODO: get uri from meta+ a.download = pipe(+ url,+ S.split("/"),+ RNEA.last,+ S.split("#"),+ RNEA.head,+ S.split("?"),+ RNEA.head+ )+document.body.appendChild(a)a.click()downloadIcon.value = "check"