diff options
author | sowgro <tpoke.ferrari@gmail.com> | 2025-03-31 11:28:42 -0400 |
---|---|---|
committer | sowgro <tpoke.ferrari@gmail.com> | 2025-03-31 11:28:42 -0400 |
commit | 5f083f775917c15597b3b70a0eb6a0ce2fda7667 (patch) | |
tree | ac9cbc93a323e4e35437c97620e3b22d23c1aaba /ufund-ui/src/app/app.component.ts | |
parent | cfe40fa1e416fbf4586ef36b63a145453a4d6224 (diff) | |
download | JellySolutions-5f083f775917c15597b3b70a0eb6a0ce2fda7667.tar.gz JellySolutions-5f083f775917c15597b3b70a0eb6a0ce2fda7667.tar.bz2 JellySolutions-5f083f775917c15597b3b70a0eb6a0ce2fda7667.zip |
More css tweaks
Diffstat (limited to 'ufund-ui/src/app/app.component.ts')
-rw-r--r-- | ufund-ui/src/app/app.component.ts | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/ufund-ui/src/app/app.component.ts b/ufund-ui/src/app/app.component.ts index 7d9afcd..8068659 100644 --- a/ufund-ui/src/app/app.component.ts +++ b/ufund-ui/src/app/app.component.ts @@ -3,6 +3,8 @@ import {BehaviorSubject, Observable} from 'rxjs'; import { DOCUMENT } from '@angular/common'; import {AuthService} from './services/auth.service'; import {ToastType} from './services/toasts.service'; +import {User} from './models/User'; +import {ActivatedRoute, Router} from '@angular/router'; interface ToastProps { type: ToastType, message: string, action?: {label: string, onAction: () => void} @@ -16,12 +18,14 @@ interface ToastProps { }) export class AppComponent implements OnInit { // title = 'ufund-ui'; - currentUser$: BehaviorSubject<string> = new BehaviorSubject<string>("Logged out."); + currentUser?: BehaviorSubject<User | null>; toast = new BehaviorSubject<ToastProps>({type: ToastType.INFO, message: "testToast"}) constructor( private authService: AuthService, + private router: Router, + private route: ActivatedRoute, @Inject(DOCUMENT) private document: Document ) {} @@ -30,14 +34,15 @@ export class AppComponent implements OnInit { } ngOnInit() { - this.authService.getCurrentUserSubject().subscribe(r => { - this.currentUser$?.next(r - ? "Logged in as " + r.username - : "Logged out." - ) - }) + this.currentUser = this.authService.getCurrentUserSubject() } + login() { + this.router.navigate(['/login'], {queryParams: {redir: this.router.url}}); + } + logout() { + location.reload() + } } |