diff options
author | sowgro <tpoke.ferrari@gmail.com> | 2025-04-07 14:04:26 -0400 |
---|---|---|
committer | sowgro <tpoke.ferrari@gmail.com> | 2025-04-07 14:04:26 -0400 |
commit | 80e86d8bb9293f6a76e25e7d1e0f0ac4aa92bf09 (patch) | |
tree | be18fdd973ba229bd51ffcdfb525e7e82543212e /ufund-ui/src/app/components/need-edit/need-edit.component.ts | |
parent | d2858b59e495186d51eebd188f84534fe68fc420 (diff) | |
download | JellySolutions-80e86d8bb9293f6a76e25e7d1e0f0ac4aa92bf09.tar.gz JellySolutions-80e86d8bb9293f6a76e25e7d1e0f0ac4aa92bf09.tar.bz2 JellySolutions-80e86d8bb9293f6a76e25e7d1e0f0ac4aa92bf09.zip |
Add required text and improve validation
Diffstat (limited to '')
-rw-r--r-- | ufund-ui/src/app/components/need-edit/need-edit.component.ts | 18 |
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( |