diff options
author | Gunther6070 <haydenhartman10@yahoo.com> | 2025-03-18 12:38:32 -0400 |
---|---|---|
committer | Gunther6070 <haydenhartman10@yahoo.com> | 2025-03-18 12:38:32 -0400 |
commit | cd24514f7b75e1cde515c99607bf3b2bc0f4fc88 (patch) | |
tree | 72fe95bb3f532bec92cd68de46da49b50e2d9a13 /ufund-ui/src/app/components | |
parent | cbb02fb9fe06601ac419e804a7c87ff8452ed889 (diff) | |
parent | 0b41684e57c79374aee3a564307cd4fdef603e7c (diff) | |
download | JellySolutions-cd24514f7b75e1cde515c99607bf3b2bc0f4fc88.tar.gz JellySolutions-cd24514f7b75e1cde515c99607bf3b2bc0f4fc88.tar.bz2 JellySolutions-cd24514f7b75e1cde515c99607bf3b2bc0f4fc88.zip |
Merge branch 'funding_basket' of https://github.com/RIT-SWEN-261-02/team-project-2245-swen-261-02-2b into funding_basket
Diffstat (limited to 'ufund-ui/src/app/components')
-rw-r--r-- | ufund-ui/src/app/components/need-list/need-list.component.html | 2 | ||||
-rw-r--r-- | ufund-ui/src/app/components/need-list/need-list.component.ts | 13 |
2 files changed, 7 insertions, 8 deletions
diff --git a/ufund-ui/src/app/components/need-list/need-list.component.html b/ufund-ui/src/app/components/need-list/need-list.component.html index 4a67dfa..36c12d0 100644 --- a/ufund-ui/src/app/components/need-list/need-list.component.html +++ b/ufund-ui/src/app/components/need-list/need-list.component.html @@ -24,5 +24,5 @@ {{need.name}} </a> <button (click)="delete(need.id)" *ngIf="isManager()">Delete</button> - <!-- <button (click)="add(need)" *ngIf="isHelper()">Add To Basket</button> --> + <button (click)="add(need)" *ngIf="isHelper()">Add To Basket</button> </li> 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 e1c0de1..46e09f0 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 @@ -105,15 +105,14 @@ export class NeedListComponent { return type === ("HELPER" as unknown as userType); } - add(need: number) { + add(need: Need) { const currentUser = this.usersService.getCurrentUser(); + console.log("get current user in angular:", currentUser) 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"); - } + currentUser.basket.push(need.id); + console.log("pushed to basket: " + currentUser.basket) + this.usersService.updateUser(currentUser).subscribe(() => { + console.log("rah"); error: (err: any) => { console.error(err); } |