import {Component, OnInit, Inject, ViewChild} from '@angular/core'; import {BehaviorSubject, Observable} from 'rxjs'; import { DOCUMENT } from '@angular/common'; import {AuthService} from './services/auth.service'; import {ToastType} from './services/toasts.service'; interface ToastProps { type: ToastType, message: string, action?: {label: string, onAction: () => void} } @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."); toast = new BehaviorSubject({type: ToastType.INFO, message: "testToast"}) constructor( private authService: AuthService, @Inject(DOCUMENT) private document: Document ) {} reloadPage() { this.document.defaultView?.location.reload(); } ngOnInit() { this.authService.getCurrentUserSubject().subscribe(r => { this.currentUser$?.next(r ? "Logged in as " + r.username : "Logged out." ) }) } }