From 1070b71f1f1df522796c43ed497554114bda8374 Mon Sep 17 00:00:00 2001 From: Fran Date: Fri, 6 Feb 2026 18:30:56 -0300 Subject: [PATCH] asd --- src/lib/stores/firebase.ts | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 src/lib/stores/firebase.ts diff --git a/src/lib/stores/firebase.ts b/src/lib/stores/firebase.ts new file mode 100644 index 0000000..df9204b --- /dev/null +++ b/src/lib/stores/firebase.ts @@ -0,0 +1,37 @@ +import { initializeApp, type FirebaseApp } from 'firebase/app'; +import { getAuth, type Auth } from 'firebase/auth'; + +import { + PUBLIC_f_apiKey, + PUBLIC_f_appId, + PUBLIC_f_authDomain, + PUBLIC_f_messagingSenderId, + PUBLIC_f_projectId, + PUBLIC_f_storageBucket +} from '$env/static/public'; + +let app: FirebaseApp | null = null; +let auth: Auth | null = null; + +const firebaseConfig = { + apiKey: PUBLIC_f_apiKey, + authDomain: PUBLIC_f_authDomain, + projectId: PUBLIC_f_projectId, + storageBucket: PUBLIC_f_storageBucket, + messagingSenderId: PUBLIC_f_messagingSenderId, + appId: PUBLIC_f_appId +}; + +export function getFirebaseApp(): FirebaseApp { + if (!app) { + app = initializeApp(firebaseConfig); + } + return app; +} + +export function getFirebaseAuth(): Auth { + if (!auth) { + auth = getAuth(getFirebaseApp()); + } + return auth; +} \ No newline at end of file