Skip to content

Open-Source API Development Ecosystem • https://hoppscotch.io • Offline, On-Prem & Cloud • Web, Desktop & CLI • Open-Source Alternative to Postman, Insomnia

fix: throwing error when settings key being empty - fixed #1409

Liyas Thomas82de03101bf4
diff --git a/components/collections/add-collection.vue b/components/collections/add-collection.vue
index ec3981562..9956c704b 100644
--- a/components/collections/add-collection.vue
+++ b/components/collections/add-collection.vue
@@ -50,7 +50,7 @@ export default {
},
methods: {
syncCollections() {
- if (fb.currentUser !== null) {
+ if (fb.currentUser !== null && fb.currentSettings[0]) {
if (fb.currentSettings[0].value) {
fb.writeCollections(JSON.parse(JSON.stringify(this.$store.state.postwoman.collections)))
}
diff --git a/components/collections/collection.vue b/components/collections/collection.vue
index c76353a32..268606072 100644
--- a/components/collections/collection.vue
+++ b/components/collections/collection.vue
@@ -132,7 +132,7 @@ export default {
},
methods: {
syncCollections() {
- if (fb.currentUser !== null) {
+ if (fb.currentUser !== null && fb.currentSettings[0]) {
if (fb.currentSettings[0].value) {
fb.writeCollections(JSON.parse(JSON.stringify(this.$store.state.postwoman.collections)))
}
diff --git a/components/collections/edit-collection.vue b/components/collections/edit-collection.vue
index b27df64b1..79144fbe5 100644
--- a/components/collections/edit-collection.vue
+++ b/components/collections/edit-collection.vue
@@ -52,7 +52,7 @@ export default {
},
methods: {
syncCollections() {
- if (fb.currentUser !== null) {
+ if (fb.currentUser !== null && fb.currentSettings[0]) {
if (fb.currentSettings[0].value) {
fb.writeCollections(JSON.parse(JSON.stringify(this.$store.state.postwoman.collections)))
}
diff --git a/components/collections/edit-folder.vue b/components/collections/edit-folder.vue
index cb414790c..a6621b994 100644
--- a/components/collections/edit-folder.vue
+++ b/components/collections/edit-folder.vue
@@ -53,7 +53,7 @@ export default {
},
methods: {
syncCollections() {
- if (fb.currentUser !== null) {
+ if (fb.currentUser !== null && fb.currentSettings[0]) {
if (fb.currentSettings[0].value) {
fb.writeCollections(JSON.parse(JSON.stringify(this.$store.state.postwoman.collections)))
}
diff --git a/components/collections/edit-request.vue b/components/collections/edit-request.vue
index c1bc187b5..2704d6636 100644
--- a/components/collections/edit-request.vue
+++ b/components/collections/edit-request.vue
@@ -57,7 +57,7 @@ export default {
},
methods: {
syncCollections() {
- if (fb.currentUser !== null) {
+ if (fb.currentUser !== null && fb.currentSettings[0]) {
if (fb.currentSettings[0].value) {
fb.writeCollections(JSON.parse(JSON.stringify(this.$store.state.postwoman.collections)))
}
diff --git a/components/collections/folder.vue b/components/collections/folder.vue
index fcdf57d85..293ca62a4 100644
--- a/components/collections/folder.vue
+++ b/components/collections/folder.vue
@@ -87,7 +87,14 @@
/>
</li>
</ul>
- <ul v-if="folder.folders && folder.folders.length === 0 && folder.requests && folder.requests.length === 0">
+ <ul
+ v-if="
+ folder.folders &&
+ folder.folders.length === 0 &&
+ folder.requests &&
+ folder.requests.length === 0
+ "
+ >
<li class="flex ml-8 border-l border-brdColor">
<p class="info"><i class="material-icons">not_interested</i> {{ $t("folder_empty") }}</p>
</li>
@@ -124,7 +131,7 @@ export default {
},
methods: {
syncCollections() {
- if (fb.currentUser !== null) {
+ if (fb.currentUser !== null && fb.currentSettings[0]) {
if (fb.currentSettings[0].value) {
fb.writeCollections(JSON.parse(JSON.stringify(this.$store.state.postwoman.collections)))
}
diff --git a/components/collections/import-export-collections.vue b/components/collections/import-export-collections.vue
index bb99c13c3..0fdfeae6b 100644
--- a/components/collections/import-export-collections.vue
+++ b/components/collections/import-export-collections.vue
@@ -259,7 +259,7 @@ export default {
this.fileImported()
},
syncToFBCollections() {
- if (fb.currentUser !== null) {
+ if (fb.currentUser !== null && fb.currentSettings[0]) {
if (fb.currentSettings[0].value) {
fb.writeCollections(JSON.parse(JSON.stringify(this.$store.state.postwoman.collections)))
}
diff --git a/components/collections/index.vue b/components/collections/index.vue
index 1c43b31d9..032534bbc 100644
--- a/components/collections/index.vue
+++ b/components/collections/index.vue
@@ -240,7 +240,7 @@ export default {
this.$data.editingRequestIndex = undefined
},
syncCollections() {
- if (fb.currentUser !== null) {
+ if (fb.currentUser !== null && fb.currentSettings[0]) {
if (fb.currentSettings[0].value) {
fb.writeCollections(JSON.parse(JSON.stringify(this.$store.state.postwoman.collections)))
}
diff --git a/components/collections/request.vue b/components/collections/request.vue
index a05d37c98..a92820404 100644
--- a/components/collections/request.vue
+++ b/components/collections/request.vue
@@ -86,7 +86,7 @@ export default {
},
methods: {
syncCollections() {
- if (fb.currentUser !== null) {
+ if (fb.currentUser !== null && fb.currentSettings[0]) {
if (fb.currentSettings[0].value) {
fb.writeCollections(JSON.parse(JSON.stringify(this.$store.state.postwoman.collections)))
}
diff --git a/components/collections/save-request-as.vue b/components/collections/save-request-as.vue
index 3f9a9ee35..d4a9245ef 100644
--- a/components/collections/save-request-as.vue
+++ b/components/collections/save-request-as.vue
@@ -144,7 +144,7 @@ export default {
},
methods: {
syncCollections() {
- if (fb.currentUser !== null) {
+ if (fb.currentUser !== null && fb.currentSettings[0]) {
if (fb.currentSettings[0].value) {
fb.writeCollections(JSON.parse(JSON.stringify(this.$store.state.postwoman.collections)))
}
diff --git a/components/environments/add-environment.vue b/components/environments/add-environment.vue
index edad95bfc..a54e95f8e 100644
--- a/components/environments/add-environment.vue
+++ b/components/environments/add-environment.vue
@@ -50,7 +50,7 @@ export default {
},
methods: {
syncEnvironments() {
- if (fb.currentUser !== null) {
+ if (fb.currentUser !== null && fb.currentSettings[1]) {
if (fb.currentSettings[1].value) {
fb.writeEnvironments(JSON.parse(JSON.stringify(this.$store.state.postwoman.environments)))
}
diff --git a/components/environments/edit-environment.vue b/components/environments/edit-environment.vue
index a85cbceca..e71d8b1b3 100644
--- a/components/environments/edit-environment.vue
+++ b/components/environments/edit-environment.vue
@@ -135,7 +135,7 @@ export default {
},
methods: {
syncEnvironments() {
- if (fb.currentUser !== null) {
+ if (fb.currentUser !== null && fb.currentSettings[1]) {
if (fb.currentSettings[1].value) {
fb.writeEnvironments(JSON.parse(JSON.stringify(this.$store.state.postwoman.environments)))
}
diff --git a/components/environments/environment.vue b/components/environments/environment.vue
index 08b3fa8ba..192d1cb87 100644
--- a/components/environments/environment.vue
+++ b/components/environments/environment.vue
@@ -51,7 +51,7 @@ export default {
},
methods: {
syncEnvironments() {
- if (fb.currentUser !== null) {
+ if (fb.currentUser !== null && fb.currentSettings[1]) {
if (fb.currentSettings[1].value) {
fb.writeEnvironments(JSON.parse(JSON.stringify(this.$store.state.postwoman.environments)))
}
diff --git a/components/environments/import-export-environment.vue b/components/environments/import-export-environment.vue
index bff235539..a9f6a7a6d 100644
--- a/components/environments/import-export-environment.vue
+++ b/components/environments/import-export-environment.vue
@@ -256,7 +256,7 @@ export default {
this.fileImported()
},
syncToFBEnvironments() {
- if (fb.currentUser !== null) {
+ if (fb.currentUser !== null && fb.currentSettings[1]) {
if (fb.currentSettings[1].value) {
fb.writeEnvironments(JSON.parse(JSON.stringify(this.$store.state.postwoman.environments)))
}
diff --git a/components/environments/index.vue b/components/environments/index.vue
index dd788ddeb..5c2dc30a5 100644
--- a/components/environments/index.vue
+++ b/components/environments/index.vue
@@ -153,7 +153,7 @@ export default {
this.$data.editingEnvironmentIndex = undefined
},
syncEnvironments() {
- if (fb.currentUser !== null) {
+ if (fb.currentUser !== null && fb.currentSettings[1]) {
if (fb.currentSettings[1].value) {
fb.writeEnvironments(JSON.parse(JSON.stringify(this.$store.state.postwoman.environments)))
}
diff --git a/pages/index.vue b/pages/index.vue
index 9588b33c1..e9bb256cf 100644
--- a/pages/index.vue
+++ b/pages/index.vue
@@ -1475,7 +1475,7 @@ export default {
}
this.$refs.historyComponent.addEntry(entry)
- if (fb.currentUser !== null) {
+ if (fb.currentUser !== null && fb.currentSettings[2]) {
if (fb.currentSettings[2].value) {
fb.writeHistory(entry)
}
@@ -1532,7 +1532,7 @@ export default {
}
this.$refs.historyComponent.addEntry(entry)
- if (fb.currentUser !== null) {
+ if (fb.currentUser !== null && fb.currentSettings[2]) {
if (fb.currentSettings[2].value) {
fb.writeHistory(entry)
}
diff --git a/pages/settings.vue b/pages/settings.vue
index f6d2d07be..2e0e9ba24 100644
--- a/pages/settings.vue
+++ b/pages/settings.vue
@@ -265,14 +265,14 @@ export default {
setTimeout(() => (target.innerHTML = '<i class="material-icons">clear_all</i>'), 1000)
},
syncCollections() {
- if (fb.currentUser !== null) {
+ if (fb.currentUser !== null && fb.currentSettings[0]) {
if (fb.currentSettings[0].value) {
fb.writeCollections(JSON.parse(JSON.stringify(this.$store.state.postwoman.collections)))
}
}
},
syncEnvironments() {
- if (fb.currentUser !== null) {
+ if (fb.currentUser !== null && fb.currentSettings[1]) {
if (fb.currentSettings[1].value) {
fb.writeEnvironments(JSON.parse(JSON.stringify(this.$store.state.postwoman.environments)))
}