From 5f795acd6111070228f40ee181a7844e9b8f3633 Mon Sep 17 00:00:00 2001 From: Andrew Bastin Date: Tue, 5 Oct 2021 22:03:33 +0530 Subject: [PATCH] feat: probable user is displayed as authenticated --- .../hoppscotch-app/components/app/Header.vue | 133 +++++++++--------- packages/hoppscotch-app/helpers/fb/auth.ts | 10 +- 2 files changed, 72 insertions(+), 71 deletions(-) diff --git a/packages/hoppscotch-app/components/app/Header.vue b/packages/hoppscotch-app/components/app/Header.vue index 90e656468..ba2829831 100644 --- a/packages/hoppscotch-app/components/app/Header.vue +++ b/packages/hoppscotch-app/components/app/Header.vue @@ -109,81 +109,84 @@ - diff --git a/packages/hoppscotch-app/helpers/fb/auth.ts b/packages/hoppscotch-app/helpers/fb/auth.ts index d6f24b20c..6ccabf4f4 100644 --- a/packages/hoppscotch-app/helpers/fb/auth.ts +++ b/packages/hoppscotch-app/helpers/fb/auth.ts @@ -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()