fix: environment and collection sync issue with firebase

This commit is contained in:
Mohamed Yussuf
2020-06-08 00:44:22 +08:00
parent d9285915ef
commit 10c568098c
3 changed files with 8 additions and 4 deletions

View File

@@ -134,7 +134,7 @@ export default {
}, },
computed: { computed: {
collections() { collections() {
return this.$store.state.postwoman.collections return fb.currentCollections;
}, },
}, },
async mounted() { async mounted() {

View File

@@ -82,7 +82,7 @@ export default {
}, },
computed: { computed: {
environments() { environments() {
return this.$store.state.postwoman.environments return fb.currentEnvironments;
}, },
}, },
async mounted() { async mounted() {

View File

@@ -200,7 +200,9 @@ firebase.auth().onAuthStateChanged((user) => {
collection.id = doc.id collection.id = doc.id
collections.push(collection) collections.push(collection)
}) })
fb.currentCollections = collections[0].collection if (collections.length > 0) {
fb.currentCollections = collections[0].collection
}
}) })
usersCollection usersCollection
@@ -213,7 +215,9 @@ firebase.auth().onAuthStateChanged((user) => {
environment.id = doc.id environment.id = doc.id
environments.push(environment) environments.push(environment)
}) })
fb.currentEnvironments = environments[0].environment if (environments.length > 0) {
fb.currentEnvironments = environments[0].environment
}
}) })
} else { } else {
fb.currentUser = null fb.currentUser = null