diff options
Diffstat (limited to 'ufund-ui/src/app/components/need-page/need-page.component.ts')
-rw-r--r-- | ufund-ui/src/app/components/need-page/need-page.component.ts | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/ufund-ui/src/app/components/need-page/need-page.component.ts b/ufund-ui/src/app/components/need-page/need-page.component.ts index 0967266..17e330c 100644 --- a/ufund-ui/src/app/components/need-page/need-page.component.ts +++ b/ufund-ui/src/app/components/need-page/need-page.component.ts @@ -32,19 +32,15 @@ export class NeedPageComponent implements OnInit { this.cupboardService.getNeed(id).subscribe(n => this.need = n); } - back() { - window.history.back(); - } - add(need: Need) { const currentUser = this.authService.getCurrentUser(); - //console.log("get current user in angular:", currentUser) if (currentUser) { if (!currentUser.basket.includes(need.id)) { currentUser.basket.push(need.id); this.usersService.updateUser(currentUser) .pipe(catchError((err, _) => { - console.error(err); + let action = {label: "View Basket", onAction: () => this.router.navigate(['/basket'])} + this.toastService.sendToast(ToastType.INFO, `"${need.name}" Added to basket`, action) return of(); })) .subscribe(() => { @@ -63,8 +59,7 @@ export class NeedPageComponent implements OnInit { return of() })) .subscribe(() => { - // this.needs = this.needs.filter(n => n.id !== id) - this.toastService.sendToast(ToastType.INFO, "Need deleted") + this.toastService.sendToast(ToastType.INFO, "Need deleted.") this.router.navigate(['/cupboard']) }) // this.refresh(); |