diff options
author | Gunther6070 <haydenhartman10@yahoo.com> | 2025-04-01 07:47:16 -0400 |
---|---|---|
committer | Gunther6070 <haydenhartman10@yahoo.com> | 2025-04-01 07:47:16 -0400 |
commit | d8330f1ac85b26d08ca4df5ce3875078d7b4f47f (patch) | |
tree | 2046e58c146097aac21c9e352771420c31df6589 /ufund-ui/src/app/services/auth.service.ts | |
parent | bc9d3417795d841b4cb3e9fb022f8d61448af946 (diff) | |
parent | 233fe120d2a9b30e0150401ebdfeb946dc9c2c07 (diff) | |
download | JellySolutions-d8330f1ac85b26d08ca4df5ce3875078d7b4f47f.tar.gz JellySolutions-d8330f1ac85b26d08ca4df5ce3875078d7b4f47f.tar.bz2 JellySolutions-d8330f1ac85b26d08ca4df5ce3875078d7b4f47f.zip |
Merge branch 'main' of https://github.com/RIT-SWEN-261-02/team-project-2245-swen-261-02-2b
Diffstat (limited to '')
-rw-r--r-- | ufund-ui/src/app/services/auth.service.ts | 14 |
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; } |