diff options
-rw-r--r-- | ufund-ui/src/app/app.component.html | 2 | ||||
-rw-r--r-- | ufund-ui/src/app/app.component.ts | 10 |
2 files changed, 9 insertions, 3 deletions
diff --git a/ufund-ui/src/app/app.component.html b/ufund-ui/src/app/app.component.html index 6b9338c..a490237 100644 --- a/ufund-ui/src/app/app.component.html +++ b/ufund-ui/src/app/app.component.html @@ -1,6 +1,6 @@ <h1>jelly solutions</h1> -<span>{{currentUser$ | async}}</span> +<span>{{currentUser$ | async}}</span> <br> <button *ngIf="currentUser$.value != 'Logged out.'" (click)="reloadPage()"> Log Out</button> <hr> <router-outlet /> diff --git a/ufund-ui/src/app/app.component.ts b/ufund-ui/src/app/app.component.ts index 6f4e1f5..7dc8ffb 100644 --- a/ufund-ui/src/app/app.component.ts +++ b/ufund-ui/src/app/app.component.ts @@ -1,6 +1,7 @@ -import {Component, OnInit} from '@angular/core'; +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', @@ -13,9 +14,14 @@ export class AppComponent implements OnInit { currentUser$: BehaviorSubject<string> = new BehaviorSubject<string>("Logged out."); constructor( - private userService: UsersService + private userService: UsersService, + @Inject(DOCUMENT) private document: Document ) {} + reloadPage() { + this.document.defaultView?.location.reload(); + } + ngOnInit() { this.userService.getCurrentUserSubject().subscribe(r => { this.currentUser$?.next(r |