chore: init steps ui

This commit is contained in:
liyasthomas
2021-12-28 06:39:33 +05:30
committed by Andrew Bastin
parent 7dace3f9b4
commit 660479f8a6

View File

@@ -20,6 +20,10 @@
/> />
</template> </template>
<template #body> <template #body>
<div v-for="(step, index) in importerSteps" :key="`step-${index}`">
{{ step }}
</div>
<div v-if="importerType > 0">start steps</div>
<div v-if="mode == 'import_export'" class="flex flex-col space-y-2 px-2"> <div v-if="mode == 'import_export'" class="flex flex-col space-y-2 px-2">
<SmartExpand> <SmartExpand>
<template #body> <template #body>
@@ -568,7 +572,7 @@ const importFromJSON = () => {
} }
let collections = JSON.parse(content) let collections = JSON.parse(content)
await hoppImporterOutput(content) await importerAction(content)
if (isInsomniaCollection(collections)) { if (isInsomniaCollection(collections)) {
collections = parseInsomniaCollection(content) collections = parseInsomniaCollection(content)
@@ -658,11 +662,12 @@ const exportJSON = () => {
}, 1000) }, 1000)
} }
const hoppImporter = RESTCollectionImporters[0] const importerType = ref(0)
const importer = RESTCollectionImporters[importerType.value]
const importerSteps = importer.steps
const hoppImporterOutput = async (content: string) => { const importerAction = async (content: string) => {
const importedFunc = await hoppImporter.importer() const result = await importer.importer([content])()
const result = await importedFunc(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)) {