refactor: update all hoppCollection type to remove generic pattern

This commit is contained in:
nivedin
2023-12-11 17:41:02 +05:30
committed by Andrew Bastin
parent 9d2b7cc03f
commit 95953557de
38 changed files with 201 additions and 257 deletions

View File

@@ -29,7 +29,6 @@ import { PropType, computed, ref } from "vue"
import { useI18n } from "~/composables/i18n"
import { useToast } from "~/composables/toast"
import { HoppCollection } from "@hoppscotch/data"
import { HoppRESTRequest } from "@hoppscotch/data"
import { appendRESTCollections, restCollections$ } from "~/newstore/collections"
import MyCollectionImport from "~/components/importExport/ImportExportSteps/MyCollectionImport.vue"
import { GetMyTeamsQuery } from "~/helpers/backend/graphql"
@@ -88,9 +87,7 @@ const showImportFailedError = () => {
toast.error(t("import.failed"))
}
const handleImportToStore = async (
collections: HoppCollection<HoppRESTRequest>[]
) => {
const handleImportToStore = async (collections: HoppCollection[]) => {
const importResult =
props.collectionsType.type === "my-collections"
? await importToPersonalWorkspace(collections)
@@ -104,18 +101,14 @@ const handleImportToStore = async (
}
}
const importToPersonalWorkspace = (
collections: HoppCollection<HoppRESTRequest>[]
) => {
const importToPersonalWorkspace = (collections: HoppCollection[]) => {
appendRESTCollections(collections)
return E.right({
success: true,
})
}
const importToTeamsWorkspace = async (
collections: HoppCollection<HoppRESTRequest>[]
) => {
const importToTeamsWorkspace = async (collections: HoppCollection[]) => {
if (!hasTeamWriteAccess.value || !selectedTeamID.value) {
return E.left({
success: false,