Merge pull request #862 from sboulema/feature/#759

We're currently facing a delayed production deploy issue with Netlify. Kindly be patient while changes are propagated to live site. Hopefully Netlify will fix this technical issue asap. I'll ping once changes are up on live.
This commit is contained in:
Liyas Thomas
2020-05-11 15:23:58 +05:30
committed by GitHub

View File

@@ -119,15 +119,28 @@ export default {
let reader = new FileReader()
reader.onload = event => {
let content = event.target.result
let environments = JSON.parse(content)
let confirmation = this.$t("file_imported")
this.$store.commit("postwoman/importAddEnvironments", {
environments,
confirmation,
})
let importFileObj = JSON.parse(content)
if (importFileObj["_postman_variable_scope"] === "environment") {
this.importFromPostman(importFileObj)
} else {
this.importFromPostwoman(importFileObj)
}
}
reader.readAsText(this.$refs.inputChooseFileToImportFrom.files[0])
},
importFromPostwoman(environments) {
let confirmation = this.$t("file_imported")
this.$store.commit("postwoman/importAddEnvironments", {
environments,
confirmation,
})
},
importFromPostman(importFileObj) {
let environment = { name: importFileObj.name, variables: [] }
importFileObj.values.forEach(element => environment.variables.push({ key: element.key, value: element.value }));
let environments = [ environment ]
this.importFromPostwoman(environments)
},
exportJSON() {
let text = this.environmentJson
text = text.replace(/\n/g, "\r\n")