diff options
author | Gunther6070 <haydenhartman10@yahoo.com> | 2025-04-01 07:45:28 -0400 |
---|---|---|
committer | Gunther6070 <haydenhartman10@yahoo.com> | 2025-04-01 07:45:28 -0400 |
commit | 726b527af983025a95daae67864122761bcc4e78 (patch) | |
tree | 2046e58c146097aac21c9e352771420c31df6589 /ufund-ui/src/app/components/cupboard/cupboard.component.ts | |
parent | b544f2617843af29875af81923d3bec539aca704 (diff) | |
parent | 0e9c0803e35a23ef2e873dc7ebf224a49a92f207 (diff) | |
download | JellySolutions-726b527af983025a95daae67864122761bcc4e78.tar.gz JellySolutions-726b527af983025a95daae67864122761bcc4e78.tar.bz2 JellySolutions-726b527af983025a95daae67864122761bcc4e78.zip |
Merge branch 'css' of https://github.com/RIT-SWEN-261-02/team-project-2245-swen-261-02-2b into css
Diffstat (limited to 'ufund-ui/src/app/components/cupboard/cupboard.component.ts')
-rw-r--r-- | ufund-ui/src/app/components/cupboard/cupboard.component.ts | 41 |
1 files changed, 1 insertions, 40 deletions
diff --git a/ufund-ui/src/app/components/cupboard/cupboard.component.ts b/ufund-ui/src/app/components/cupboard/cupboard.component.ts index 662def4..2230cd3 100644 --- a/ufund-ui/src/app/components/cupboard/cupboard.component.ts +++ b/ufund-ui/src/app/components/cupboard/cupboard.component.ts @@ -16,7 +16,7 @@ import {ToastsService, ToastType} from '../../services/toasts.service'; export class CupboardComponent implements OnInit { - selectedForm = "create"; + selectedForm?: string = undefined; needs: any; @ViewChild("needList") needList?: NeedListComponent @@ -82,45 +82,6 @@ export class CupboardComponent implements OnInit { return type === ("MANAGER" as unknown as userType); } - update(form: any) { - console.log(form); - const need: Need = { - name: form.name, - image: form.image, - location: form.location, - id: this.selectedNeed.id, //system will control this - maxGoal: form.maxGoal, - type: GoalType[form.type as keyof typeof GoalType], - urgent: form.urgent, - filterAttributes: [], - current: 0, - description: form.description - }; - - 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"); - } - return of() - })) - .subscribe( - (result) => { - if (result) { - console.log("need updated successfully"); - this.needList?.refresh() - } else { - console.log("need update failed"); - } - } - - ); - } - submit(form: any) { const need: Need = { name: form.name, |