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

102
Views
How to combine switchMap with combineLatest

I need to combine UserRole from RealtimeDatabase and User from FirebaseAuth. How do I combine these two queries, one of which is based on the other? The following code allows you to download a single file or two files simultaneously.

from(this.auth.signInWithEmailAndPassword(email, password))
      .pipe(
        switchMap((result: any) => this.getUserRole(result.user.uid)),
        take(1)
      )
      .subscribe(console.warn);

or

combineLatest([x1, this.getUserRole('8OKFSRBeZ3dY4ecQVn8AyJHBQim2')])
  .pipe(tap(console.warn))
.subscribe();
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Does it work for you? Note: combineLatest may be not the best for the case, you can try frokJoin.

from(this.auth.signInWithEmailAndPassword(email, password))
    .pipe(
        switchMap((result: any) => combineLatest(of(result.user), this.getUserRole(result.user.uid))),
    )
    .subscribe(console.warn);
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!