diff --git a/frontend/src/ts/firebase.ts b/frontend/src/ts/firebase.ts index f3fcfec57..c2d286d60 100644 --- a/frontend/src/ts/firebase.ts +++ b/frontend/src/ts/firebase.ts @@ -2,17 +2,22 @@ import { FirebaseApp, initializeApp } from "firebase/app"; import { getAuth, Auth as AuthType } from "firebase/auth"; import { firebaseConfig } from "./constants/firebase-config"; // eslint-disable-line require-path-exists/exists +import * as Notifications from "./elements/notifications"; // Initialize Firebase -export let app: FirebaseApp; -export let Auth: AuthType; +export let app: FirebaseApp | undefined; +export let Auth: AuthType | undefined; try { app = initializeApp(firebaseConfig); Auth = getAuth(app); + // throw new Error("Firebase is not initialized"); } catch (e) { + app = undefined; + Auth = undefined; console.error(e); - $("body").text( - "Failed to initialize Firebase. Are you sure you have the correct config in the firebase-config.ts file?" - ); + Notifications.addBanner("Offline mode", 0, undefined, true); + // $("body").text( + // "Failed to initialize Firebase. Are you sure you have the correct config in the firebase-config.ts file?" + // ); }