Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

290
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda