aboutsummaryrefslogtreecommitdiff
path: root/ufund-ui/src/app/app.component.ts
blob: a85d04bf36043e46bcbe137540c0cbe4c302dd8a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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',
  templateUrl: './app.component.html',
  standalone: false,
  styleUrl: './app.component.css'
})
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)
        })
    }

}