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 | 19 |
1 files changed, 19 insertions, 0 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 b21979f..953904c 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 @@ -96,6 +96,25 @@ export class NeedListComponent { return type === ("MANAGER" as unknown as userType); } + isHelper() { + const type = this.usersService.getCurrentUser()?.type; + console.log(type); + return type === ("HELPER" as unknown as userType); + } + + add(need: Need) { + const currentUser = this.usersService.getCurrentUser(); + if (currentUser) { + this.usersService.updateUser(currentUser.username).subscribe(() => { + const currentUser = this.usersService.getCurrentUser(); + if (currentUser && currentUser.basket) { + currentUser.basket.push(need); + } + }); + } + + } + back() { this.searchResults = []; } |