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

287
Views
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 answers
Answer question

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 Report
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!