aboutsummaryrefslogtreecommitdiff
path: root/ufund-ui/src/app/components/need-edit/need-edit.component.ts
diff options
context:
space:
mode:
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.ts18
1 files changed, 3 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 b63d9c1..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
@@ -56,13 +56,7 @@ export class NeedEditComponent implements OnChanges {
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(
@@ -83,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(