diff options
Diffstat (limited to 'ufund-ui/src/app/components/funding-basket/funding-basket.component.ts')
-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); } |