diff options
author | Gunther6070 <haydenhartman10@yahoo.com> | 2025-03-18 14:45:28 -0400 |
---|---|---|
committer | Gunther6070 <haydenhartman10@yahoo.com> | 2025-03-18 14:45:28 -0400 |
commit | 83c03f9cbdf7fe94e9cbc0ffb7b75ee9e3d6eaa4 (patch) | |
tree | bea832fbb2740ad78920e72c152cd53413b6917d | |
parent | 521c8a49bbebb514a0a309a4f4f28d6e1204b7d2 (diff) | |
parent | 6b3c96302f3fc1aa5ad24676f5891dc2bb696414 (diff) | |
download | JellySolutions-83c03f9cbdf7fe94e9cbc0ffb7b75ee9e3d6eaa4.tar.gz JellySolutions-83c03f9cbdf7fe94e9cbc0ffb7b75ee9e3d6eaa4.tar.bz2 JellySolutions-83c03f9cbdf7fe94e9cbc0ffb7b75ee9e3d6eaa4.zip |
Merge branch 'funding_basket' of https://github.com/RIT-SWEN-261-02/team-project-2245-swen-261-02-2b into funding_basket
-rw-r--r-- | ufund-ui/src/app/components/need-list/need-list.component.ts | 20 |
1 files changed, 12 insertions, 8 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 2764c7e..25f05d6 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 @@ -109,14 +109,18 @@ export class NeedListComponent { const currentUser = this.usersService.getCurrentUser(); //console.log("get current user in angular:", currentUser) if (currentUser) { - currentUser.basket.push(need.id); - //console.log("pushed to basket: " + currentUser.basket) - this.usersService.updateUser(currentUser).subscribe(() => { - this.usersService.refreshBasket(); - error: (err: any) => { - console.error(err); - } - }); + if (!currentUser.basket.includes(need.id)) { + currentUser.basket.push(need.id); + this.usersService.updateUser(currentUser).subscribe(() => { + this.usersService.refreshBasket(); + error: (err: any) => { + console.error(err); + } + }); + } else { + window.alert("This need is already in your basket!") + } + } |