GraphQL collections (#1536)

This commit is contained in:
Isha Gupta
2021-03-18 20:25:12 +05:30
committed by GitHub
parent 942b86c647
commit e565f9bf72
27 changed files with 2035 additions and 89 deletions

View File

@@ -172,7 +172,7 @@ export default {
})
.then(({ files }) => {
let collections = JSON.parse(Object.values(files)[0].content)
this.$store.commit("postwoman/replaceCollections", collections)
this.$store.commit("postwoman/replaceCollections", { data: collections, flag: "rest" })
this.fileImported()
this.syncToFBCollections()
})
@@ -203,9 +203,10 @@ export default {
} else if (collections.info && collections.info.schema.includes("v2.1.0")) {
collections = [this.parsePostmanCollection(collections)]
} else {
return this.failedImport()
this.failedImport()
return
}
this.$store.commit("postwoman/replaceCollections", collections)
this.$store.commit("postwoman/replaceCollections", { data: collections, flag: "rest" })
this.fileImported()
this.syncToFBCollections()
}
@@ -227,9 +228,10 @@ export default {
collections = JSON.parse(content.replaceAll(/{{([a-z]+)}}/gi, "<<$1>>"))
collections = [this.parsePostmanCollection(collections)]
} else {
return this.failedImport()
this.failedImport()
return
}
this.$store.commit("postwoman/importCollections", collections)
this.$store.commit("postwoman/importCollections", { data: collections, flag: "rest" })
this.fileImported()
this.syncToFBCollections()
}
@@ -255,13 +257,19 @@ export default {
})
},
syncCollections() {
this.$store.commit("postwoman/replaceCollections", fb.currentCollections)
this.$store.commit("postwoman/replaceCollections", {
data: fb.currentCollections,
flag: "rest",
})
this.fileImported()
},
syncToFBCollections() {
if (fb.currentUser !== null && fb.currentSettings[0]) {
if (fb.currentSettings[0].value) {
fb.writeCollections(JSON.parse(JSON.stringify(this.$store.state.postwoman.collections)))
fb.writeCollections(
JSON.parse(JSON.stringify(this.$store.state.postwoman.collections)),
"collections"
)
}
}
},