import {Component, OnInit, Inject} from '@angular/core'; import {UsersService} from './services/users.service'; import {BehaviorSubject} from 'rxjs'; import { DOCUMENT } from '@angular/common'; @Component({ selector: 'app-root', templateUrl: './app.component.html', standalone: false, styleUrl: './app.component.css' }) export class AppComponent implements OnInit { // title = 'ufund-ui'; currentUser$: BehaviorSubject = new BehaviorSubject("Logged out."); constructor( private userService: UsersService, @Inject(DOCUMENT) private document: Document ) {} reloadPage() { this.document.defaultView?.location.reload(); } ngOnInit() { this.userService.getCurrentUserSubject().subscribe(r => { this.currentUser$?.next(r ? "Logged in as " + r.username : "Logged out." ) }) } }