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

254
Visualizações
How to properly update user information in firebase?

I have a code that is a form, basically is suppose to update the user information. According to Firebase documentation manage user but for some reason I'm getting this errors

enter image description here

This is what I have I don't think I'm missing anything is pretty much the same The only difference is that on my firebase.js I made new cons to make codes shorter but that shouldn't affect at all.

firebase.js

const db = firebase.firestore();
const auth = firebase.auth();
const storage = firebase.storage();

export {db, auth, storage};

Code

import {auth} from "./firebase"

const authUser = auth.currentUser
    const update = (e) => {
        e.preventDefault();
        authUser.updateProfile({
                displayName: {fullName}
        })
    }

I just wanted to test it on the user name first and then do all the others but I don't understand why is not working is super simple.

Update

enter image description here

about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

authUser is undefined. This means that auth.currentUser was undefined at the time when it was assigned to authUser. This probably means that the user is not logged in. You will need to handle the case when the user is not logged in, like

import {auth} from "./firebase"

const authUser = auth.currentUser
    const update = (e) => {
        e.preventDefault();
        
        if (authUser) {
            authUser.updateProfile({
                displayName: fullName
            })
        } else {
            //User is not logged in, handle that case here
        }
    }
about 4 years ago · Juan Pablo Isaza Relatório

0

import {auth} from "./firebase";
const authUser = auth.currentUser;
const update = (e) => {
    e.preventDefault();
    authUser?.updateProfile({
        displayName: fullName
    });
}
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