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: add sync firebase for all the commit

Mohamed Yussuff477998b2fb9
diff --git a/components/collections/addCollection.vue b/components/collections/addCollection.vue
index 518db55d4..e00dec3c3 100644
--- a/components/collections/addCollection.vue
+++ b/components/collections/addCollection.vue
@@ -78,6 +78,7 @@ export default {
},
hideModal() {
this.$emit("hide-modal")
+ this.$data.name = undefined
},
},
}
diff --git a/components/collections/collection.vue b/components/collections/collection.vue
index f4d52df49..c59209826 100644
--- a/components/collections/collection.vue
+++ b/components/collections/collection.vue
@@ -87,6 +87,8 @@ ul li {
</style>
<script>
+import { fb } from "../../functions/fb"
+
export default {
components: {
folder: () => import("./folder"),
@@ -103,6 +105,13 @@ export default {
}
},
methods: {
+ syncCollections() {
+ if (fb.currentUser !== null) {
+ if (fb.currentSettings[0].value) {
+ fb.writeCollections(JSON.parse(JSON.stringify(this.$store.state.postwoman.collections)))
+ }
+ }
+ },
toggleShowChildren() {
this.showChildren = !this.showChildren
},
@@ -111,6 +120,7 @@ export default {
this.$store.commit("postwoman/removeCollection", {
collectionIndex: this.collectionIndex,
})
+ this.syncCollections();
},
editFolder(collectionIndex, folder, folderIndex) {
this.$emit("edit-folder", { collectionIndex, folder, folderIndex })
diff --git a/components/collections/editCollection.vue b/components/collections/editCollection.vue
index 7d7fb4248..96c9bde52 100644
--- a/components/collections/editCollection.vue
+++ b/components/collections/editCollection.vue
@@ -43,6 +43,8 @@
</template>
<script>
+import { fb } from "../../functions/fb"
+
export default {
props: {
show: Boolean,
@@ -58,6 +60,13 @@ export default {
}
},
methods: {
+ syncCollections() {
+ if (fb.currentUser !== null) {
+ if (fb.currentSettings[0].value) {
+ fb.writeCollections(JSON.parse(JSON.stringify(this.$store.state.postwoman.collections)))
+ }
+ }
+ },
saveCollection() {
if (!this.$data.name) {
this.$toast.info(this.$t("invalid_collection_name"))
@@ -71,7 +80,8 @@ export default {
collection: collectionUpdated,
collectionIndex: this.$props.editingCollectionIndex,
})
- this.$emit("hide-modal")
+ this.$emit("hide-modal");
+ this.syncCollections();
},
hideModal() {
this.$emit("hide-modal")
diff --git a/components/collections/editFolder.vue b/components/collections/editFolder.vue
index 611938de2..0a161f903 100644
--- a/components/collections/editFolder.vue
+++ b/components/collections/editFolder.vue
@@ -38,6 +38,8 @@
</template>
<script>
+import { fb } from "../../functions/fb"
+
export default {
props: {
show: Boolean,
@@ -55,6 +57,13 @@ export default {
}
},
methods: {
+ syncCollections() {
+ if (fb.currentUser !== null) {
+ if (fb.currentSettings[0].value) {
+ fb.writeCollections(JSON.parse(JSON.stringify(this.$store.state.postwoman.collections)))
+ }
+ }
+ },
editFolder() {
this.$store.commit("postwoman/editFolder", {
collectionIndex: this.$props.collectionIndex,
@@ -62,6 +71,7 @@ export default {
folderIndex: this.$props.folderIndex,
})
this.hideModal()
+ this.syncCollections();
},
hideModal() {
this.$emit("hide-modal")
diff --git a/components/collections/editRequest.vue b/components/collections/editRequest.vue
index 175a79ca5..b8bb99a4b 100644
--- a/components/collections/editRequest.vue
+++ b/components/collections/editRequest.vue
@@ -69,6 +69,8 @@
</template>
<script>
+import { fb } from "../../functions/fb"
+
export default {
props: {
show: Boolean,
@@ -106,6 +108,13 @@ export default {
},
},
methods: {
+ syncCollections() {
+ if (fb.currentUser !== null) {
+ if (fb.currentSettings[0].value) {
+ fb.writeCollections(JSON.parse(JSON.stringify(this.$store.state.postwoman.collections)))
+ }
+ }
+ },
saveRequest() {
const userSelectedAnyCollection = this.$data.requestUpdateData.collectionIndex !== undefined
@@ -130,6 +139,7 @@ export default {
})
this.hideModal()
+ this.syncCollections();
},
hideModal() {
this.$emit("hide-modal")
diff --git a/components/collections/folder.vue b/components/collections/folder.vue
index 3066d77b8..89e5c1ef5 100644
--- a/components/collections/folder.vue
+++ b/components/collections/folder.vue
@@ -70,6 +70,8 @@ ul li {
</style>
<script>
+import { fb } from "../../functions/fb"
+
export default {
props: {
folder: Object,
@@ -85,6 +87,13 @@ export default {
}
},
methods: {
+ syncCollections() {
+ if (fb.currentUser !== null) {
+ if (fb.currentSettings[0].value) {
+ fb.writeCollections(JSON.parse(JSON.stringify(this.$store.state.postwoman.collections)))
+ }
+ }
+ },
toggleShowChildren() {
this.showChildren = !this.showChildren
},
@@ -97,6 +106,7 @@ export default {
collectionIndex: this.collectionIndex,
folderIndex: this.folderIndex,
})
+ this.syncCollections();
},
editFolder() {
this.$emit("edit-folder")
diff --git a/components/collections/request.vue b/components/collections/request.vue
index b2f2072e6..d55b8f59d 100644
--- a/components/collections/request.vue
+++ b/components/collections/request.vue
@@ -42,6 +42,8 @@ ul li {
</style>
<script>
+import { fb } from "../../functions/fb"
+
export default {
props: {
request: Object,
@@ -50,6 +52,13 @@ export default {
requestIndex: Number,
},
methods: {
+ syncCollections() {
+ if (fb.currentUser !== null) {
+ if (fb.currentSettings[0].value) {
+ fb.writeCollections(JSON.parse(JSON.stringify(this.$store.state.postwoman.collections)))
+ }
+ }
+ },
selectRequest() {
this.$store.commit("postwoman/selectRequest", { request: this.request })
},
@@ -60,6 +69,7 @@ export default {
folderIndex: this.folderIndex,
requestIndex: this.requestIndex,
})
+ this.syncCollections();
},
},
}
diff --git a/components/environments/editEnvironment.vue b/components/environments/editEnvironment.vue
index c540ac311..a05eedd6e 100644
--- a/components/environments/editEnvironment.vue
+++ b/components/environments/editEnvironment.vue
@@ -115,6 +115,7 @@
<script>
import textareaAutoHeight from "../../directives/textareaAutoHeight"
+import { fb } from "../../functions/fb"
export default {
directives: {
@@ -152,6 +153,13 @@ export default {
},
},
methods: {
+ syncEnvironments() {
+ if (fb.currentUser !== null) {
+ if (fb.currentSettings[1].value) {
+ fb.writeEnvironments(JSON.parse(JSON.stringify(this.$store.state.postwoman.environments)))
+ }
+ }
+ },
clearContent(e) {
this.$store.commit("postwoman/removeVariables", [])
e.target.innerHTML = this.doneButton
@@ -163,6 +171,7 @@ export default {
addEnvironmentVariable() {
let value = { key: "", value: "" }
this.$store.commit("postwoman/addVariable", value)
+ this.syncEnvironments()
},
removeEnvironmentVariable(index) {
let variableIndex = index
@@ -182,6 +191,7 @@ export default {
},
},
})
+ this.syncEnvironments()
},
saveEnvironment() {
if (!this.$data.name) {
@@ -197,6 +207,7 @@ export default {
environmentIndex: this.$props.editingEnvironmentIndex,
})
this.$emit("hide-modal")
+ this.syncEnvironments()
},
hideModal() {
this.$data.name = undefined
diff --git a/components/environments/environment.vue b/components/environments/environment.vue
index 9faa5fe95..e7afb2bb3 100644
--- a/components/environments/environment.vue
+++ b/components/environments/environment.vue
@@ -42,15 +42,25 @@ ul li {
</style>
<script>
+import { fb } from "../../functions/fb"
+
export default {
props: {
environment: Object,
environmentIndex: Number,
},
methods: {
+ syncEnvironments() {
+ if (fb.currentUser !== null) {
+ if (fb.currentSettings[1].value) {
+ fb.writeEnvironments(JSON.parse(JSON.stringify(this.$store.state.postwoman.environments)))
+ }
+ }
+ },
removeEnvironment() {
if (!confirm("Are you sure you want to remove this environment?")) return
this.$store.commit("postwoman/removeEnvironment", this.environmentIndex)
+ this.syncEnvironments()
},
},
}