refactor: eliminate redundancy

This commit is contained in:
jamesgeorge007
2023-12-18 23:29:35 +05:30
parent 2affb21d22
commit e23bc2d864
6 changed files with 20 additions and 60 deletions

View File

@@ -40,7 +40,7 @@ import { initializeDownloadCollection } from "~/helpers/import-export/export"
import { computed } from "vue"
import { useReadonlyStream } from "~/composables/stream"
import { environmentsExporter } from "~/helpers/import-export/export/environments"
import { environmentsGistExporter } from "~/helpers/import-export/export/environmentsGistExport"
import { gistExporter } from "~/helpers/import-export/export/gist"
import { platform } from "~/platform"
const t = useI18n()
@@ -265,13 +265,13 @@ const HoppEnvironmentsGistExporter: ImporterOrExporter = {
title:
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
currentUser?.value.provider === "github.com"
currentUser?.value?.provider === "github.com"
? "export.create_secret_gist_tooltip_text"
: "export.require_github",
icon: IconUser,
disabled: !currentUser.value
? true
: currentUser.value.provider !== "github.com",
: currentUser.value?.provider !== "github.com",
applicableTo: ["personal-workspace", "team-workspace"],
isLoading: isEnvironmentGistExportInProgress,
},
@@ -290,9 +290,10 @@ const HoppEnvironmentsGistExporter: ImporterOrExporter = {
const accessToken = currentUser.value?.accessToken
if (accessToken) {
const res = await environmentsGistExporter(
const res = await gistExporter(
JSON.stringify(environmentJson.value),
accessToken
accessToken,
"hoppscotch-environment.json"
)
if (E.isLeft(res)) {