fix: collection parser for hopp importer

This commit is contained in:
liyasthomas
2021-12-23 13:04:47 +05:30
committed by Andrew Bastin
parent 681a957611
commit a9292eed9e
4 changed files with 24 additions and 5 deletions

View File

@@ -8,10 +8,13 @@ import {
translateToNewRESTCollection,
} from "~/newstore/collections"
const importer: HoppImporter<Collection<HoppRESTRequest>> = (content) =>
const importer: HoppImporter<Collection<HoppRESTRequest>[]> = (content) =>
pipe(
E.tryCatch(
() => translateToNewRESTCollection(content),
() =>
JSON.parse(content).map((coll: any) =>
translateToNewRESTCollection(coll)
),
() => IMPORTER_INVALID_FILE_FORMAT
),
TE.fromEither

View File

@@ -30,7 +30,7 @@ export type HoppImporterDefintion<T> = {
}
export const RESTCollectionImporters: HoppImporterDefintion<
Collection<HoppRESTRequest>
Collection<HoppRESTRequest>[]
>[] = [
{
name: "Hoppscotch REST Collection",