Add firebase sync code for new environment state system

This commit is contained in:
Andrew Bastin
2021-06-04 22:52:06 -04:00
parent 5bfeb541fc
commit 6ea9d16f87

View File

@@ -46,7 +46,6 @@ export class FirebaseInstance {
this.idToken = null this.idToken = null
this.currentFeeds = [] this.currentFeeds = []
this.currentSettings = [] this.currentSettings = []
this.currentEnvironments = []
this.currentUser$ = new ReplaySubject(1) this.currentUser$ = new ReplaySubject(1)
this.idToken$ = new ReplaySubject(1) this.idToken$ = new ReplaySubject(1)
@@ -56,7 +55,7 @@ export class FirebaseInstance {
let loadedGraphqlHistory = false let loadedGraphqlHistory = false
let loadedRESTCollections = false let loadedRESTCollections = false
let loadedGraphqlCollections = false let loadedGraphqlCollections = false
const loadedEnvironments = false let loadedEnvironments = false
graphqlCollectionStore.subject$.subscribe(({ state }) => { graphqlCollectionStore.subject$.subscribe(({ state }) => {
if ( if (
@@ -300,9 +299,10 @@ export class FirebaseInstance {
environment.id = doc.id environment.id = doc.id
environments.push(environment) environments.push(environment)
}) })
if (environments.length > 0) {
this.currentEnvironments = environments[0].environment loadedEnvironments = false
} replaceEnvironments(environments)
loadedEnvironments = true
}) })
} else { } else {
this.currentUser = null this.currentUser = null