constructor()

in src/app/app.component.ts [17:31]


  constructor(private amplifyService: AmplifyService, private router: Router) {
    this.amplifyService.authStateChange$
      .subscribe(authState => {
        this.signedIn = authState.state === 'signedIn';
        if (!authState.user) {
          this.user = null;

        } else {
          this.user = authState.user;
          this.loggedinuser = this.user.attributes.email;
          console.log('Loggedin User', this.user);
          this.router.navigate(['/dashboard']);
        }
      });
  }