-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfirebaseConfig.js
More file actions
29 lines (25 loc) · 829 Bytes
/
Copy pathfirebaseConfig.js
File metadata and controls
29 lines (25 loc) · 829 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// firebaseConfig.js
import { initializeApp, getApps, getApp } from "firebase/app";
import { getFirestore } from "firebase/firestore";
import { getStorage } from "firebase/storage";
// ✅ Your exact config
const firebaseConfig = {
apiKey: "AIzaSyBGAMovZd0v-M2sj8fna3pkJJRI8Dgl4rc",
authDomain: "chatapp-4840f.firebaseapp.com",
projectId: "chatapp-4840f",
storageBucket: "chatapp-4840f.firebasestorage.app",
messagingSenderId: "1045157353122",
appId: "1:1045157353122:web:8894f53a74f0104367e9fb",
measurementId: "G-G7432FFNB1"
};
// ✅ Guard against re-initialization
let app;
if (getApps().length === 0) {
app = initializeApp(firebaseConfig);
console.log('✅ Firebase initialized');
} else {
app = getApp();
}
const db = getFirestore(app);
const storage = getStorage(app);
export { app, db, storage };