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

288
Visualizações
Redux-Toolkit, Firestore- Field section in firestore empty

I'm trying to create a collection in firestore, but the field section inside firestore comes out empty. The collection i.e 'user' and doc i.e 'email' section is created, but with 'field' section corresponding to the doc 'email' empty(it must show watchList:[]. I want the setDoc function to store the watchlist(corresponding to different emails). I want this to happen when the user signsIn. Please help. Thank you

    e.preventDefault();
    try {
      const result = await createUserWithEmailAndPassword(
        auth,
        email,
        password
      );
      navigate("/account");
      console.log(result);
      dispatch(
        storeUser({
          email: result.user.email,
        })
      );
      return await setDoc(doc(db, "users", email), {
        watchList: [],
      });
    } catch (error) {
      alert(error.message);
    }```

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

0

My guess is that the dispatch is also running asynchronously. If that is the case, you can use the result.user.email value in the database call too:

  return await setDoc(doc(db, "users", result.user.email), {
    watchList: [],
  });
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