Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

212
Views
firebase getDownloadURL no actualiza mi estado en el código de reacción js

el problema: ese usuario subirá la imagen y el

  1. el código devolverá la URL de descarga

  2. establecer el estado en la url

  3. almacene la url en el almacenamiento local, el código que hace lo siguiente es: importar {

     getDownloadURL, ref, uploadBytesResumable, UploadTask, } from 'firebase/storage'; import { IState } from '../store/state'; import { storage } from '../../firebase'; const getDownload = async (uploadTask: UploadTask, state: IState) => { const downloadUrl = getDownloadURL(uploadTask.snapshot.ref).then( (downloadURL) => { console.log('File available at', downloadURL); localStorage.setItem('logoUrl', downloadURL); return downloadURL; } ); return downloadUrl; }; export const uploadLogo = async (file: any, state: IState) => { // if (!file) return; const sotrageRef = ref(storage, `files/${file.name}`); const uploadTask = uploadBytesResumable(sotrageRef, file); return uploadTask.on( 'state_changed', (snapshot: { bytesTransferred: number; totalBytes: number }) => { const prog = Math.round( (snapshot.bytesTransferred / snapshot.totalBytes) * 100 ); }, (error: any) => console.log(error), async () => { state.logoUrl = await getDownload(uploadTask, state); } ); };

el usuario presiona el botón para cargar su imagen, luego el almacenamiento local se actualiza con la nueva URL pero el estado no

pd: estoy usando Overmind para administrar mi estado

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!