From 9340f9bedca34eff098ae1bc4b8c742754e233fa Mon Sep 17 00:00:00 2001 From: Miodec Date: Tue, 27 Sep 2022 22:29:52 +0200 Subject: [PATCH] showing offline mode reason on localhost --- frontend/src/ts/firebase.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/frontend/src/ts/firebase.ts b/frontend/src/ts/firebase.ts index c2d286d60..4fe253f37 100644 --- a/frontend/src/ts/firebase.ts +++ b/frontend/src/ts/firebase.ts @@ -11,12 +11,19 @@ export let Auth: AuthType | undefined; try { app = initializeApp(firebaseConfig); Auth = getAuth(app); - // throw new Error("Firebase is not initialized"); + throw new Error("Firebase is not initialized"); } catch (e) { app = undefined; Auth = undefined; console.error(e); - Notifications.addBanner("Offline mode", 0, undefined, true); + const error = e as Error; + Notifications.addBanner( + "Offline mode: " + + (window.location.hostname === "localhost" ? error.message : ""), + 0, + undefined, + true + ); // $("body").text( // "Failed to initialize Firebase. Are you sure you have the correct config in the firebase-config.ts file?" // );