Remove dead image storage code
This commit is contained in:
parent
ce3d092497
commit
8817aed22e
|
@ -14,7 +14,6 @@ import {
|
||||||
onSnapshot,
|
onSnapshot,
|
||||||
} from 'firebase/firestore'
|
} from 'firebase/firestore'
|
||||||
import { getAuth } from 'firebase/auth'
|
import { getAuth } from 'firebase/auth'
|
||||||
import { ref, getStorage, uploadBytes, getDownloadURL } from 'firebase/storage'
|
|
||||||
import { GoogleAuthProvider, signInWithPopup } from 'firebase/auth'
|
import { GoogleAuthProvider, signInWithPopup } from 'firebase/auth'
|
||||||
import { zip } from 'lodash'
|
import { zip } from 'lodash'
|
||||||
import { app, db } from './init'
|
import { app, db } from './init'
|
||||||
|
@ -202,20 +201,6 @@ export async function firebaseLogout() {
|
||||||
await auth.signOut()
|
await auth.signOut()
|
||||||
}
|
}
|
||||||
|
|
||||||
const storage = getStorage(app)
|
|
||||||
// Example: uploadData('avatars/ajfi8iejsf.png', data)
|
|
||||||
export async function uploadData(
|
|
||||||
path: string,
|
|
||||||
data: ArrayBuffer | Blob | Uint8Array
|
|
||||||
) {
|
|
||||||
const uploadRef = ref(storage, path)
|
|
||||||
// Uploaded files should be cached for 1 day, then revalidated
|
|
||||||
// See https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control
|
|
||||||
const metadata = { cacheControl: 'public, max-age=86400, must-revalidate' }
|
|
||||||
await uploadBytes(uploadRef, data, metadata)
|
|
||||||
return await getDownloadURL(uploadRef)
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function listUsers(userIds: string[]) {
|
export async function listUsers(userIds: string[]) {
|
||||||
if (userIds.length > 10) {
|
if (userIds.length > 10) {
|
||||||
throw new Error('Too many users requested at once; Firestore limits to 10')
|
throw new Error('Too many users requested at once; Firestore limits to 10')
|
||||||
|
|
Loading…
Reference in New Issue
Block a user