From 82adaedb5a110265d795e802cb3832a586a387bd Mon Sep 17 00:00:00 2001 From: bcho892 Date: Sat, 19 Oct 2024 13:30:08 +1300 Subject: [PATCH] fix double initialistation --- client/src/firebase.ts | 4 +++- client/src/services/Storage/StorageService.ts | 6 ++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/client/src/firebase.ts b/client/src/firebase.ts index b85d3b1bb..b2df890ce 100644 --- a/client/src/firebase.ts +++ b/client/src/firebase.ts @@ -17,6 +17,7 @@ import { MembershipPaymentStore } from "@/store/MembershipPayment" import queryClient from "@/services/QueryClient" import { BOOKING_AVAILABLITY_KEY } from "@/services/Booking/BookingQueries" import { MEMBERSHIP_CLIENT_SECRET_KEY } from "@/services/Payment/PaymentQueries" +import { getStorage } from "firebase/storage" const firebaseConfig: FirebaseOptions = { apiKey: process.env.NEXT_PUBLIC_FIREBASE_API_KEY, @@ -31,6 +32,7 @@ const firebaseConfig: FirebaseOptions = { const app = initializeApp(firebaseConfig) const auth = getAuth(app) const db = getFirestore(app) +const storage = getStorage(app) let analytics: Analytics | null = null isSupported().then((yes) => { @@ -80,4 +82,4 @@ export const fireAnalytics = ( } } -export { auth, db, analytics } +export { auth, db, analytics, storage } diff --git a/client/src/services/Storage/StorageService.ts b/client/src/services/Storage/StorageService.ts index ec089682f..c39554112 100644 --- a/client/src/services/Storage/StorageService.ts +++ b/client/src/services/Storage/StorageService.ts @@ -1,12 +1,10 @@ +import { storage } from "@/firebase" import { getDownloadURL, ref as storageRef, - uploadBytes, - getStorage + uploadBytes } from "firebase/storage" -const storage = getStorage() - // https://stackoverflow.com/a/19842865 const uid = () => { return Date.now().toString(36) + Math.random().toString(36).substr(2)