Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

228
Visualizações
Update photoURL Firebase v9 web, react Javascript

I'm following a Udemy firebase Udemy tutorial for creating a firebase web application using javascript and react. The course material is a bit our of date. I want to know how to change a user's photoURL - they log up with email and password, and I have a seperate hook to handle the sign up information.

Below is the code the Udemy course gives to update a user's photoURL - does anyone know how I would write this in Firebase v9? Thank you!

// upload user thumbnail
      const uploadPath = `thumbnails/${res.user.uid}/${thumbnail.name}`
      const img = await projectStorage.ref(uploadPath).put(thumbnail)
      const imgUrl = await img.ref.getDownloadURL()

      // add display AND PHOTO_URL name to user
      await res.user.updateProfile({ displayName, photoURL: imgUrl })
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Rewriting from pre-v9 to v9 is usually quite simple, especially if you follow the upgrade guide or compare the v8 and v9 samples in the documentation on uploading files.

In your code, this v8 code:

const uploadPath = `thumbnails/${res.user.uid}/${thumbnail.name}`
const img = await projectStorage.ref(uploadPath).put(thumbnail)
const imgUrl = await img.ref.getDownloadURL()

// add display AND PHOTO_URL name to user
await res.user.updateProfile({ displayName, photoURL: imgUrl })

Becomes this in v9 and above:

const uploadPath = `thumbnails/${res.user.uid}/${thumbnail.name}`
const img = await uploadBytes(ref(projectStorage, uploadPath, thumbnail))
const imgUrl = await getDownloadUrl(img.ref)

// add display AND PHOTO_URL name to user
await updateProfile(res.user, { displayName, photoURL: imgUrl })

If you watch carefully, you'll see that most of the change is just in moving the namespaced object.operation() method calls into a modular/functional operation(object) form. Aside from that, the biggest difference here is that put is now called uploadBytes.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda