diff options
Diffstat (limited to 'ufund-ui/src/app/app.component.ts')
-rw-r--r-- | ufund-ui/src/app/app.component.ts | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/ufund-ui/src/app/app.component.ts b/ufund-ui/src/app/app.component.ts index 2dbf33c..6f4e1f5 100644 --- a/ufund-ui/src/app/app.component.ts +++ b/ufund-ui/src/app/app.component.ts @@ -1,4 +1,6 @@ -import { Component } from '@angular/core'; +import {Component, OnInit} from '@angular/core'; +import {UsersService} from './services/users.service'; +import {BehaviorSubject} from 'rxjs'; @Component({ selector: 'app-root', @@ -6,6 +8,21 @@ import { Component } from '@angular/core'; standalone: false, styleUrl: './app.component.css' }) -export class AppComponent { - title = 'ufund-ui'; +export class AppComponent implements OnInit { + // title = 'ufund-ui'; + currentUser$: BehaviorSubject<string> = new BehaviorSubject<string>("Logged out."); + + constructor( + private userService: UsersService + ) {} + + ngOnInit() { + this.userService.getCurrentUserSubject().subscribe(r => { + this.currentUser$?.next(r + ? "Logged in as " + r.username + : "Logged out." + ) + }) + } + } |