aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAkash Keshav <112591754+domesticchores@users.noreply.github.com>2025-03-18 01:10:56 -0400
committerAkash Keshav <112591754+domesticchores@users.noreply.github.com>2025-03-18 01:10:56 -0400
commita5046e6bf22308ae516ef6d7abb5ae8709e925db (patch)
tree08ea93ffc579dd12491b08e831b4243d62e33a40
parentb41b2f48247e4260074e4f7fbff57d33d772efa8 (diff)
downloadJellySolutions-a5046e6bf22308ae516ef6d7abb5ae8709e925db.tar.gz
JellySolutions-a5046e6bf22308ae516ef6d7abb5ae8709e925db.tar.bz2
JellySolutions-a5046e6bf22308ae516ef6d7abb5ae8709e925db.zip
added log out button. -ak
-rw-r--r--ufund-ui/src/app/app.component.html2
-rw-r--r--ufund-ui/src/app/app.component.ts10
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