Fix the annoying firebase already initialized error!
This commit is contained in:
parent
f952ea109a
commit
9c5463235a
|
@ -1,5 +1,5 @@
|
||||||
import { getFirestore } from '@firebase/firestore'
|
import { getFirestore } from '@firebase/firestore'
|
||||||
import { initializeApp } from 'firebase/app'
|
import { initializeApp, getApps, getApp } from 'firebase/app'
|
||||||
|
|
||||||
// TODO: Reenable this when we have a way to set the Firebase db in dev
|
// TODO: Reenable this when we have a way to set the Firebase db in dev
|
||||||
// export const isProd = process.env.NODE_ENV === 'production'
|
// export const isProd = process.env.NODE_ENV === 'production'
|
||||||
|
@ -26,5 +26,6 @@ const firebaseConfig = isProd
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initialize Firebase
|
// Initialize Firebase
|
||||||
export const app = initializeApp(firebaseConfig)
|
export const app = getApps().length ? getApp() : initializeApp(firebaseConfig)
|
||||||
|
|
||||||
export const db = getFirestore(app)
|
export const db = getFirestore(app)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user