diff options
author | benal01 <bja4245@rit.edu> | 2025-03-17 23:44:37 -0400 |
---|---|---|
committer | benal01 <bja4245@rit.edu> | 2025-03-17 23:44:37 -0400 |
commit | 361f73f967475089e995b62079316bd91232570e (patch) | |
tree | 7d68c4d081dbe8d992477c5386aad0e78fff89c9 | |
parent | ea1eb74494392c809396545317bbf3d4ec7696ba (diff) | |
download | JellySolutions-361f73f967475089e995b62079316bd91232570e.tar.gz JellySolutions-361f73f967475089e995b62079316bd91232570e.tar.bz2 JellySolutions-361f73f967475089e995b62079316bd91232570e.zip |
implemetation of needs from API call
-rw-r--r-- | ufund-ui/src/app/components/funding-basket/funding-basket.component.ts | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/ufund-ui/src/app/components/funding-basket/funding-basket.component.ts b/ufund-ui/src/app/components/funding-basket/funding-basket.component.ts index d3b0a7f..418158f 100644 --- a/ufund-ui/src/app/components/funding-basket/funding-basket.component.ts +++ b/ufund-ui/src/app/components/funding-basket/funding-basket.component.ts @@ -31,15 +31,16 @@ export class FundingBasketComponent implements return; } this.cupboardService.getNeeds().subscribe(n => this.needs = n) - this.usersService.getCurrentUser()?.subscribe(user => { - this.user = user; - this.getBasketNeeds(); - }); + const currentUser = this.usersService.getCurrentUser(); + if (currentUser) { + this.user = currentUser; + } + this.getBasketNeeds(); } getBasketNeeds(): void { - if (this.user && this.user.cupboard) { - this.user.cupboard.forEach(need => { + if (this.user && this.needs) { + this.needs.forEach(need => { if (this.isInBasket(need)){ this.basket.push(need); } |