import { ref, uploadBytes, getDownloadURL } from 'firebase/storage' import { storage } from './config.js'; export async function uploadImage(file) { //create unique file name and stores them in one folder in firebase const filename = `messages/${Date.now()}_${file.name}`; const storageRef = ref(storage, filename); await uploadBytes(storageRef, file); return getDownloadURL(storageRef); }