diff --git a/web/lib/firebase/init.ts b/web/lib/firebase/init.ts index 12f3d832..bf712a8f 100644 --- a/web/lib/firebase/init.ts +++ b/web/lib/firebase/init.ts @@ -1,5 +1,6 @@ import { getFirestore } from '@firebase/firestore' import { initializeApp, getApps, getApp } from 'firebase/app' +import { getStorage } from 'firebase/storage' import { FIREBASE_CONFIG } from 'common/envs/constants' import { connectFirestoreEmulator } from 'firebase/firestore' import { connectFunctionsEmulator, getFunctions } from 'firebase/functions' @@ -8,6 +9,7 @@ import { connectFunctionsEmulator, getFunctions } from 'firebase/functions' export const app = getApps().length ? getApp() : initializeApp(FIREBASE_CONFIG) export const db = getFirestore() export const functions = getFunctions() +export const storage = getStorage() declare global { /* eslint-disable-next-line no-var */ diff --git a/web/lib/firebase/storage.ts b/web/lib/firebase/storage.ts index 5293a6bc..2fc2ccc7 100644 --- a/web/lib/firebase/storage.ts +++ b/web/lib/firebase/storage.ts @@ -1,11 +1,5 @@ -import { - getStorage, - ref, - uploadBytesResumable, - getDownloadURL, -} from 'firebase/storage' - -const storage = getStorage() +import { ref, uploadBytesResumable, getDownloadURL } from 'firebase/storage' +import { storage } from './init' // TODO: compress large images export const uploadImage = async (