diff options
Diffstat (limited to 'ufund-ui/src/app/components')
| -rw-r--r-- | ufund-ui/src/app/components/funding-basket/funding-basket.component.ts | 45 | 
1 files changed, 21 insertions, 24 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 7f086ec..66b9fd1 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 @@ -42,7 +42,7 @@ export class FundingBasketComponent implements OnInit {        let contribution = c as HTMLInputElement;        console.log(contribution.value, contribution.id);        contribution.setAttribute("style",""); -      if ( contribution.value == '' || contribution.valueAsNumber < 0) { +      if ( contribution.value == '' || contribution.valueAsNumber <= 0) {          this.isValid = false;          contribution.setAttribute("style","color: #ff0000");        } @@ -53,30 +53,27 @@ export class FundingBasketComponent implements OnInit {          let need = await firstValueFrom(this.cupboardService.getNeed(+contribution.id));          need.current +=+ contribution.value;          console.log(need); -        this.usersService.removeNeed(need.id); +        this.usersService.removeNeed(+need.id);          this.cupboardService.updateNeed(need.id, need) -                    .pipe(catchError((ex, r) => { -                        console.log(ex.status); -                        if (ex.status == 500) { -                            this.statusText.next("Fields cannot be blank"); -                        } else if (ex.status == 400) { -                            this.statusText.next("Goal must be greater than 0"); -                        } else { -                            this.statusText.next("Error on creating need"); -                        } -                        return new Observable<string>(); -                    })) -                    .subscribe( -                        (result) => { -                            if (result) { -                                console.log("need updated successfully"); -                                //this.needList?.refresh() -                            } else { -                                console.log("need update failed"); -                            } -                        } -         -                    ); +            .pipe(catchError((ex, r) => { +                console.log(ex.status); +                if (ex.status == 500) { +                    this.statusText.next('Fields cannot be blank'); +                } else if (ex.status == 400) { +                    this.statusText.next('Goal must be greater than 0'); +                } else { +                    this.statusText.next('Error on creating need'); +                } +                return new Observable<string>(); +            })) +            .subscribe((result) => { +                if (result) { +                    console.log('need updated successfully'); +                    //this.needList?.refresh() +                } else { +                    console.log('need update failed'); +                } +            });        }      }    }  | 
