diff options
author | Hayden Hartman <haydenhartman10@gmail.com> | 2025-03-18 07:50:55 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-03-18 07:50:55 -0400 |
commit | 3362bba1ccf1cee3985be95ab74a2456e6503d7a (patch) | |
tree | 64f6b52fbd4714a29be0102ac988cb7ab02dbb33 /ufund-ui/src/app/components/need-list/need-list.component.ts | |
parent | f063bf6e8634386f6ae3a3cf13fe2228e74454c9 (diff) | |
parent | bd41fc58b5537a12072625bbf75baf75d5ed2274 (diff) | |
download | JellySolutions-2.0.tar.gz JellySolutions-2.0.tar.bz2 JellySolutions-2.0.zip |
Merge pull request #13 from RIT-SWEN-261-02/funding_basketv2.0
funding-basket merge
Diffstat (limited to '')
-rw-r--r-- | ufund-ui/src/app/components/need-list/need-list.component.ts | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/ufund-ui/src/app/components/need-list/need-list.component.ts b/ufund-ui/src/app/components/need-list/need-list.component.ts index fc2a594..e1c0de1 100644 --- a/ufund-ui/src/app/components/need-list/need-list.component.ts +++ b/ufund-ui/src/app/components/need-list/need-list.component.ts @@ -100,6 +100,29 @@ export class NeedListComponent { return type === ("MANAGER" as unknown as userType); } + isHelper() { + const type = this.usersService.getCurrentUser()?.type; + return type === ("HELPER" as unknown as userType); + } + + add(need: number) { + const currentUser = this.usersService.getCurrentUser(); + if (currentUser) { + this.usersService.updateUser(currentUser.username, currentUser).subscribe(() => { + const currentUser = this.usersService.getCurrentUser(); + if (currentUser && currentUser.basket) { + currentUser.basket.push(need); + console.log("added to basket"); + } + error: (err: any) => { + console.error(err); + } + }); + + } + + } + back() { this.searchResults = []; } |