feat: probable user is displayed as authenticated

This commit is contained in:
Andrew Bastin
2021-10-05 22:03:33 +05:30
committed by liyasthomas
parent 3f5fcae280
commit 409989eddb
2 changed files with 72 additions and 71 deletions

View File

@@ -95,18 +95,16 @@ export function initAuth() {
probableUser$.next(JSON.parse(getLocalConfig("login_state") ?? "null"))
currentUser$.subscribe((user) => {
onAuthStateChanged(auth, (user) => {
/** Whether the user was logged in before */
const wasLoggedIn = currentUser$.value !== null
if (user) {
probableUser$.next(user)
} else {
probableUser$.next(null)
removeLocalConfig("login_state")
}
})
onAuthStateChanged(auth, (user) => {
/** Whether the user was logged in before */
const wasLoggedIn = currentUser$.value !== null
if (!user && extraSnapshotStop) {
extraSnapshotStop()