Skip to content

Commit

Permalink
Fix ExpressionChangedAfterItHasBeenCheckedError going from logged in …
Browse files Browse the repository at this point in the history
…to /logout
  • Loading branch information
nathanfranklin committed Apr 5, 2021
1 parent 539db50 commit 8a3641e
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/app/components/main/main.component.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
import { Component, AfterContentInit } from '@angular/core';
import {Component, OnInit, ChangeDetectionStrategy} from '@angular/core';
import {AuthenticatedUser, AuthService} from '../../services/authentication.service';
import {MAIN, LOGIN} from '../../constants/routes';
import {MAIN} from '../../constants/routes';
import { Router, ActivatedRoute } from '@angular/router';

@Component({
selector: 'app-main',
templateUrl: './main.component.html',
styleUrls: ['./main.component.styl']
styleUrls: ['./main.component.styl'],
changeDetection: ChangeDetectionStrategy.OnPush
})
export class MainComponent implements AfterContentInit {
public currentUser: AuthenticatedUser;
export class MainComponent implements OnInit {
public currentUser: AuthenticatedUser = null;
private afterLoginRoute: string;

constructor(
Expand All @@ -21,7 +22,7 @@ export class MainComponent implements AfterContentInit {
this.afterLoginRoute = MAIN;
}

ngAfterContentInit() {
ngOnInit() {
if (this.authService.isLoggedIn()) {
this.authService.getUserInfo();
}
Expand Down

0 comments on commit 8a3641e

Please sign in to comment.