diff options
author | Akash Keshav <112591754+domesticchores@users.noreply.github.com> | 2025-03-18 16:53:39 -0400 |
---|---|---|
committer | Akash Keshav <112591754+domesticchores@users.noreply.github.com> | 2025-03-18 16:53:39 -0400 |
commit | 81b93fc671ba35d67c414937e18b686fd6d5f861 (patch) | |
tree | e19ad608e4d27a5c5f6620ce41aa1b53a99f4274 /ufund-ui/src | |
parent | 9d90b2a29b1f47b6271fd9ea87989a4195cf5ee6 (diff) | |
download | JellySolutions-81b93fc671ba35d67c414937e18b686fd6d5f861.tar.gz JellySolutions-81b93fc671ba35d67c414937e18b686fd6d5f861.tar.bz2 JellySolutions-81b93fc671ba35d67c414937e18b686fd6d5f861.zip |
idk but it works. funding basket worsk. -ak
Diffstat (limited to 'ufund-ui/src')
-rw-r--r-- | ufund-ui/src/app/components/funding-basket/funding-basket.component.ts | 45 | ||||
-rw-r--r-- | ufund-ui/src/app/services/users.service.ts | 9 |
2 files changed, 29 insertions, 25 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'); + } + }); } } } diff --git a/ufund-ui/src/app/services/users.service.ts b/ufund-ui/src/app/services/users.service.ts index 62aea79..ddbd322 100644 --- a/ufund-ui/src/app/services/users.service.ts +++ b/ufund-ui/src/app/services/users.service.ts @@ -45,6 +45,7 @@ export class UsersService { } updateUser(user: User): Observable<User> { + console.log("REMOVING USER IN ANGULAR: ", user) console.log(user, user.basket) console.log(this.apiKey) @@ -89,7 +90,13 @@ export class UsersService { let newArr = this.basket.getValue().filter(v => v.id != id); this.basket.next(newArr); this.getCurrentUser()!.basket = newArr.map(need => need.id); - this.updateUser(this.getCurrentUser()!); + console.log(this.getCurrentUser()!.basket) + this.updateUser(this.getCurrentUser()!).subscribe(() => { + this.refreshBasket(); + error: (err: any) => { + console.error(err); + } + }); } getBasket() { |