fix: split importers list

This commit is contained in:
liyasthomas
2021-12-28 11:26:09 +05:30
committed by Andrew Bastin
parent 660479f8a6
commit d5866fbb3b
3 changed files with 7 additions and 7 deletions

View File

@@ -178,7 +178,7 @@ import {
Collection, Collection,
makeCollection, makeCollection,
} from "~/newstore/collections" } from "~/newstore/collections"
import { RESTCollectionImporters } from "~/helpers/import-export/import" import { RESTCollectionImporters } from "~/helpers/import-export/import/importers"
const props = defineProps<{ const props = defineProps<{
show: boolean show: boolean
@@ -663,11 +663,11 @@ const exportJSON = () => {
} }
const importerType = ref(0) const importerType = ref(0)
const importer = RESTCollectionImporters[importerType.value] const importerModule = RESTCollectionImporters[importerType.value]
const importerSteps = importer.steps const importerSteps = importerModule.steps
const importerAction = async (content: string) => { const importerAction = async (content: string) => {
const result = await importer.importer([content])() const result = await importerModule.importer([content])()
if (E.isLeft(result)) { if (E.isLeft(result)) {
console.log("error", result.left) console.log("error", result.left)
} else if (E.isRight(result)) { } else if (E.isRight(result)) {

View File

@@ -0,0 +1,3 @@
import HoppRESTCollImporter from "./hopp"
export const RESTCollectionImporters = [HoppRESTCollImporter] as const

View File

@@ -1,6 +1,5 @@
import * as TE from "fp-ts/TaskEither" import * as TE from "fp-ts/TaskEither"
import { StepsOutputList } from "../steps" import { StepsOutputList } from "../steps"
import HoppRESTCollImporter from "../import/hopp"
/** /**
* The error state to be used when the file formats do not match * The error state to be used when the file formats do not match
@@ -46,5 +45,3 @@ export const defineImporter = <ReturnType, StepType>(input: {
...input, ...input,
} }
} }
export const RESTCollectionImporters = [HoppRESTCollImporter] as const