Skip to content

Commit

Permalink
feat: export auth from firebase
Browse files Browse the repository at this point in the history
  • Loading branch information
ZL-Asica committed Oct 26, 2024
1 parent 636f56b commit 0918e1a
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions src/utils/firebaseConfig.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
// Import the functions you need from the SDKs you need
import { initializeApp } from 'firebase/app';
import { getAuth } from 'firebase/auth';
import {
CACHE_SIZE_UNLIMITED,
initializeFirestore,
persistentLocalCache,
persistentSingleTabManager,
} from 'firebase/firestore';
// TODO: Add SDKs for Firebase products that you want to use
// https://firebase.google.com/docs/web/setup#available-libraries

Expand All @@ -17,6 +24,13 @@ const firebaseConfig = {

// Initialize Firebase
const app = initializeApp(firebaseConfig);
const db = getFirestore(app);

export { db };
// Enable IndexedDB persistence with single-tab manager
export const db = initializeFirestore(app, {
localCache: persistentLocalCache({
tabManager: persistentSingleTabManager(),
cacheSizeBytes: CACHE_SIZE_UNLIMITED,
}),
});

export const auth = getAuth(app);

0 comments on commit 0918e1a

Please sign in to comment.