I am creating login page,data is coming from database.i have used 2 login account. i login with one username and then in navbar i am displaying username, after when i logged out and login with another username it is showing the previous username. and when i press f5 then it is displaying correct username, pls help me i dont want to refresh the page.

in navbar component i am fetching data in ngOnInit

```
ngOnInit() {
        if(this.auth.loggedIn()){
            this.auth.getProfile().subscribe(profile=>{
                this.user=profile.user;
            },
            err=>{
                console.log(err);
                return false;
            });
        }
}   

```

here's template 

```
  <li *ngIf="auth.loggedIn()">
          <a href="#>{{user?.name | uppercase}}</a>
</li>

```