Added nav-bar to show home link and user status
This commit is contained in:
@ -1,7 +1,5 @@
|
||||
import { Component, OnInit} from '@angular/core';
|
||||
import { AuthService} from '../auth/auth.service';
|
||||
import { Observable } from 'rxjs';
|
||||
import { map, share } from 'rxjs/operators';
|
||||
|
||||
@Component({
|
||||
selector: 'app-home',
|
||||
@ -9,15 +7,10 @@ import { map, share } from 'rxjs/operators';
|
||||
styleUrls: ['./home.component.css']
|
||||
})
|
||||
export class HomeComponent implements OnInit {
|
||||
public user: Observable<string>;
|
||||
|
||||
constructor(public auth: AuthService) {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.user = this.auth.userObservable.pipe(
|
||||
map (x => x.isAuthenticated ? x.name : null),
|
||||
share()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user