title: Routing to user detail inside a map
body: <p>I'm trying to route a normal user to his detail page</p>
  
  <p>I've tried to route inside a map but I guess I'm doing it wrong</p>
  
  <pre class="lang-js prettyprint-override"><code>
  import { Component, OnInit, OnDestroy } from '@angular/core';
  import { FormGroup, FormBuilder, Validators } from '@angular/forms';
  import { HttpClient } from '@angular/common/http';
  import { environment } from '../../environments/environment';
  import { Router } from '@angular/router';
  import { AuthFacade } from 'libs/client/ngrx/src/lib/auth/+state/auth.facade';
  import { Subscription, Observable, observable } from 'rxjs';
  import { map } from 'rxjs/operators';
  import { User } from '@trilog/types';
  
  
  @Component({
    selector: 'a-login',
    templateUrl: './login.component.html',
    styleUrls: ['./login.component.scss']
  })
  export class LoginComponent implements OnInit, OnDestroy {
    form: FormGroup;
  
    user$: Observable&lt;User&gt; = this.authFacade.user$;
    isAdmin$: Observable&lt;boolean&gt; = this.user$.pipe(map(user =&gt; user &amp;&amp; user.roles.some(role =&gt; (role.key == 'admin') || (role.key == 'system'))));
    id$: Observable&lt;String&gt; = this.user$.pipe(map(user =&gt; user &amp;&amp; user._id))
  
    error$: Observable&lt;any&gt; = this.authFacade.authError$.pipe(map((err: any) =&gt; {
      if (err) {
        return err.error ? err.error.message : err.message
      }
    }));
  
    private authSub: Subscription;
  
    constructor(
      private http: HttpClient,
      private fb: FormBuilder,
      private router: Router,
      private authFacade: AuthFacade,
    ) {
      this.form = this.fb.group({
        email: ['', Validators.required],
        password: ['', Validators.required]
      });
  
      this.authSub = this.authFacade.isAdmin$.subscribe(isAdmin =&gt; {
  
        if (isAdmin) {
          // console.log("Is admin?", isAdmin);
          this.router.navigate(['/']).then(() =&gt; console.log('nav done')).catch(err =&gt; console.log(err));
        }
        else {
          // this.router.navigate(['/users/', this.id$])
          console.log("Hello")
          return this.user$.pipe(map(user =&gt; this.router.navigate(['/users/',user._id])))
          // return this.authFacade.user$.pipe(map(user =&gt; user &amp;&amp; this.router.navigate(['/users/',user._id])))
        //  return this.user$.pipe(map(user =&gt; user &amp;&amp; this.router.navigate(['/users/',user._id])))
        }
      });
    }
  
    ngOnInit() {
    }
  
    ngOnDestroy() {
      if (this.authSub) { this.authSub.unsubscribe(); }
    }
  
    login() {
      if (this.form.valid) {
        this.authFacade.login(this.form.value);
      }
  
    }
  
  }
  
  
  </code></pre>
  
  <p>Right now when log in as an admin everything works fine, but when i log in as a normal user it should route me to the user's detail page instead all im getting is the "Hello" from console log</p>