aboutsummaryrefslogtreecommitdiff
path: root/ufund-ui/src/app/services/auth.service.ts
diff options
context:
space:
mode:
authorTyler Ferrari <69283684+Sowgro@users.noreply.github.com>2025-04-01 02:17:25 -0400
committerGitHub <noreply@github.com>2025-04-01 02:17:25 -0400
commit233fe120d2a9b30e0150401ebdfeb946dc9c2c07 (patch)
tree98583e1b1d21d1a0cc57e8ff3489fbbf758eccff /ufund-ui/src/app/services/auth.service.ts
parentc6bbb29f42eaea7d0c8aebdb7b95be0287cbf4f9 (diff)
parent0e9c0803e35a23ef2e873dc7ebf224a49a92f207 (diff)
downloadJellySolutions-233fe120d2a9b30e0150401ebdfeb946dc9c2c07.tar.gz
JellySolutions-233fe120d2a9b30e0150401ebdfeb946dc9c2c07.tar.bz2
JellySolutions-233fe120d2a9b30e0150401ebdfeb946dc9c2c07.zip
Merge pull request #22 from RIT-SWEN-261-02/css
Merge css into main
Diffstat (limited to 'ufund-ui/src/app/services/auth.service.ts')
-rw-r--r--ufund-ui/src/app/services/auth.service.ts14
1 files changed, 12 insertions, 2 deletions
diff --git a/ufund-ui/src/app/services/auth.service.ts b/ufund-ui/src/app/services/auth.service.ts
index 6bc7145..b75c931 100644
--- a/ufund-ui/src/app/services/auth.service.ts
+++ b/ufund-ui/src/app/services/auth.service.ts
@@ -1,7 +1,8 @@
-import {Injectable} from '@angular/core';
+import {Injectable, Injector} from '@angular/core';
import {BehaviorSubject, firstValueFrom} from 'rxjs';
import {User} from '../models/User';
import {HttpClient, HttpHeaders} from '@angular/common/http';
+import {UsersService} from './users.service';
@Injectable({
providedIn: 'root'
@@ -24,7 +25,9 @@ export class AuthService {
});
constructor(
- private http: HttpClient
+ private http: HttpClient,
+ // private userService: UsersService
+ private injector: Injector
) {}
async login(username: string, password: string) {
@@ -42,6 +45,13 @@ export class AuthService {
// this.currentUser.subscribe(r => console.log("currentUser: "+r.username))
}
+ async restoreLogin(username: string, key: string) {
+
+ const userService = this.injector.get(UsersService);
+ this.apiKey = key;
+ this.currentUser.next(await firstValueFrom(userService.getUser(username)))
+ }
+
getCurrentUserSubject() {
return this.currentUser;
}