Fix the annoying firebase already initialized error!

This commit is contained in:
jahooma 2022-01-20 23:32:04 -06:00
parent f952ea109a
commit 9c5463235a

View File

@ -1,5 +1,5 @@
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
// export const isProd = process.env.NODE_ENV === 'production'
@ -26,5 +26,6 @@ const firebaseConfig = isProd
}
// Initialize Firebase
export const app = initializeApp(firebaseConfig)
export const app = getApps().length ? getApp() : initializeApp(firebaseConfig)
export const db = getFirestore(app)