Move getStorage() into init.ts after initializeApp() is called.
This commit is contained in:
parent
deaa595f07
commit
0c328bc398
|
@ -1,5 +1,6 @@
|
||||||
import { getFirestore } from '@firebase/firestore'
|
import { getFirestore } from '@firebase/firestore'
|
||||||
import { initializeApp, getApps, getApp } from 'firebase/app'
|
import { initializeApp, getApps, getApp } from 'firebase/app'
|
||||||
|
import { getStorage } from 'firebase/storage'
|
||||||
import { FIREBASE_CONFIG } from 'common/envs/constants'
|
import { FIREBASE_CONFIG } from 'common/envs/constants'
|
||||||
import { connectFirestoreEmulator } from 'firebase/firestore'
|
import { connectFirestoreEmulator } from 'firebase/firestore'
|
||||||
import { connectFunctionsEmulator, getFunctions } from 'firebase/functions'
|
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 app = getApps().length ? getApp() : initializeApp(FIREBASE_CONFIG)
|
||||||
export const db = getFirestore()
|
export const db = getFirestore()
|
||||||
export const functions = getFunctions()
|
export const functions = getFunctions()
|
||||||
|
export const storage = getStorage()
|
||||||
|
|
||||||
declare global {
|
declare global {
|
||||||
/* eslint-disable-next-line no-var */
|
/* eslint-disable-next-line no-var */
|
||||||
|
|
|
@ -1,11 +1,5 @@
|
||||||
import {
|
import { ref, uploadBytesResumable, getDownloadURL } from 'firebase/storage'
|
||||||
getStorage,
|
import { storage } from './init'
|
||||||
ref,
|
|
||||||
uploadBytesResumable,
|
|
||||||
getDownloadURL,
|
|
||||||
} from 'firebase/storage'
|
|
||||||
|
|
||||||
const storage = getStorage()
|
|
||||||
|
|
||||||
// TODO: compress large images
|
// TODO: compress large images
|
||||||
export const uploadImage = async (
|
export const uploadImage = async (
|
||||||
|
|
Loading…
Reference in New Issue
Block a user