aboutsummaryrefslogtreecommitdiff
path: root/ufund-ui/src/app/components/need-edit/need-edit.component.ts
diff options
context:
space:
mode:
authorsowgro <tpoke.ferrari@gmail.com>2025-04-07 21:00:53 -0400
committersowgro <tpoke.ferrari@gmail.com>2025-04-07 21:00:53 -0400
commit426b21de0a3f7ee8706b83af4acddb731798be2c (patch)
treeb51bda63a4bbbef158353600a878e8192f7f7952 /ufund-ui/src/app/components/need-edit/need-edit.component.ts
parent71e01e85a33b0109847867878b2af733b4751e46 (diff)
parent7617db08a43d873a65abd47b02e23ad8cb4cb5cd (diff)
downloadJellySolutions-426b21de0a3f7ee8706b83af4acddb731798be2c.tar.gz
JellySolutions-426b21de0a3f7ee8706b83af4acddb731798be2c.tar.bz2
JellySolutions-426b21de0a3f7ee8706b83af4acddb731798be2c.zip
Merge branch 'main' into call-to-action
Diffstat (limited to 'ufund-ui/src/app/components/need-edit/need-edit.component.ts')
-rw-r--r--ufund-ui/src/app/components/need-edit/need-edit.component.ts19
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(