diff options
author | sowgro <tpoke.ferrari@gmail.com> | 2025-04-07 16:49:21 -0400 |
---|---|---|
committer | sowgro <tpoke.ferrari@gmail.com> | 2025-04-07 16:49:21 -0400 |
commit | 8b64b8bd43f987b924d74d0ea597b7b606ca9357 (patch) | |
tree | c8c3229c54955a4a037b0ce0a016221e8784af42 /ufund-ui/src/app/components/need-edit/need-edit.component.ts | |
parent | bb4e0e55fee7ec8f34c36e6299301d612a0de2ce (diff) | |
parent | 7635188ed6182a72facd8ab3299f13c7217a8abd (diff) | |
download | JellySolutions-8b64b8bd43f987b924d74d0ea597b7b606ca9357.tar.gz JellySolutions-8b64b8bd43f987b924d74d0ea597b7b606ca9357.tar.bz2 JellySolutions-8b64b8bd43f987b924d74d0ea597b7b606ca9357.zip |
Merge branch 'main' into light-mode
# Conflicts:
# ufund-ui/src/styles.css
Diffstat (limited to '')
-rw-r--r-- | ufund-ui/src/app/components/need-edit/need-edit.component.ts | 19 |
1 files changed, 4 insertions, 15 deletions
diff --git a/ufund-ui/src/app/components/need-edit/need-edit.component.ts b/ufund-ui/src/app/components/need-edit/need-edit.component.ts index abfa543..3c42c34 100644 --- a/ufund-ui/src/app/components/need-edit/need-edit.component.ts +++ b/ufund-ui/src/app/components/need-edit/need-edit.component.ts @@ -39,7 +39,7 @@ export class NeedEditComponent implements OnChanges { id: this.needCopy.id, //system will control this maxGoal: form.maxGoal, type: GoalType[form.type as keyof typeof GoalType], - urgent: form.urgent, + urgent: form.urgent ?? false, filterAttributes: [], current: 0, description: form.description @@ -53,15 +53,10 @@ export class NeedEditComponent implements OnChanges { } updateNeed(need: Need) { + need.current = this.need?.current ?? 0 this.cupboardService.updateNeed(need.id, need) .pipe(catchError((ex, _) => { - if (ex.status == 500) { - this.toastService.sendToast(ToastType.ERROR, 'Fields cannot be blank'); - } else if (ex.status == 400) { - this.toastService.sendToast(ToastType.ERROR, ex.error); - } else { - this.toastService.sendToast(ToastType.ERROR, "Error on creating need"); - } + this.toastService.sendToast(ToastType.ERROR, ex.error); return of() })) .subscribe( @@ -82,13 +77,7 @@ export class NeedEditComponent implements OnChanges { createNeed(need: Need) { this.cupboardService.createNeed(need) .pipe(catchError((ex, _) => { - if (ex.status == 500) { - this.toastService.sendToast(ToastType.ERROR, "Fields cannot be blank"); - } else if (ex.status == 400) { - this.toastService.sendToast(ToastType.ERROR, ex.error); - } else { - this.toastService.sendToast(ToastType.ERROR, "Error on creating need"); - } + this.toastService.sendToast(ToastType.ERROR, ex.error); return of() })) .subscribe( |