diff options
Diffstat (limited to 'ufund-ui/src/app/app.component.ts')
-rw-r--r-- | ufund-ui/src/app/app.component.ts | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/ufund-ui/src/app/app.component.ts b/ufund-ui/src/app/app.component.ts index 2dbf33c..a85d04b 100644 --- a/ufund-ui/src/app/app.component.ts +++ b/ufund-ui/src/app/app.component.ts @@ -1,4 +1,7 @@ -import { Component } from '@angular/core'; +import {Component, OnInit} from '@angular/core'; +import {UsersService} from './services/users.service'; +import {BehaviorSubject, Observable, Subject} from 'rxjs'; +import {User} from './models/User'; @Component({ selector: 'app-root', @@ -6,6 +9,18 @@ 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.getCurrentUser().subscribe(r => { + this.currentUser$?.next("Logged in as " + r.username) + }) + } + } |