diff options
Diffstat (limited to 'ufund-ui/src/app/components/need-list/need-list.component.ts')
-rw-r--r-- | ufund-ui/src/app/components/need-list/need-list.component.ts | 13 |
1 files changed, 6 insertions, 7 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 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); } |