aboutsummaryrefslogtreecommitdiff
path: root/ufund-ui
diff options
context:
space:
mode:
authorbenal01 <bja4245@rit.edu>2025-03-31 22:52:49 -0400
committerbenal01 <bja4245@rit.edu>2025-03-31 22:52:49 -0400
commit4186983da13740ec0a4731770ac238922631be11 (patch)
tree2c3a13246596e01d4bc95166d25548311e5be25f /ufund-ui
parent786a6db3f5a22f7bb2cc249731ef654b675c3c86 (diff)
downloadJellySolutions-4186983da13740ec0a4731770ac238922631be11.tar.gz
JellySolutions-4186983da13740ec0a4731770ac238922631be11.tar.bz2
JellySolutions-4186983da13740ec0a4731770ac238922631be11.zip
auto refresh with emitter
Diffstat (limited to 'ufund-ui')
-rw-r--r--ufund-ui/src/app/components/cupboard/cupboard.component.html1
-rw-r--r--ufund-ui/src/app/components/need-edit/need-edit.component.ts6
2 files changed, 4 insertions, 3 deletions
diff --git a/ufund-ui/src/app/components/cupboard/cupboard.component.html b/ufund-ui/src/app/components/cupboard/cupboard.component.html
index e9387a2..2cfbe2d 100644
--- a/ufund-ui/src/app/components/cupboard/cupboard.component.html
+++ b/ufund-ui/src/app/components/cupboard/cupboard.component.html
@@ -8,6 +8,7 @@
<button [ngClass]="selectedForm === 'create' ? 'selected-tab' : 'tab'" (click)="selectForm('create')">Create new Need</button>
<button [ngClass]="selectedForm === 'update' ? 'selected-tab' : 'tab'" (click)="selectForm('update')">Update existing Need</button>
</div>
+ <app-need-edit [selectedNeed]="selectedNeed" (refreshNeedList)="needList.refresh()"></app-need-edit>
<div id="create-form" *ngIf="selectedForm === 'create'">
<h1> Create Need </h1>
<form #cupboardForm="ngForm" (ngSubmit)="submit(cupboardForm.value)">
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 02ffb71..2462534 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
@@ -1,4 +1,4 @@
-import { Component, Input, Output } from '@angular/core';
+import { Component, Input, Output, EventEmitter } from '@angular/core';
import { Need, GoalType } from '../../models/Need';
import { CupboardService } from '../../services/cupboard.service';
import { catchError, of } from 'rxjs';
@@ -18,7 +18,7 @@ export class NeedEditComponent {
) {}
@Input() selectedNeed!: Need;
- @Output() selectedNeedID: number | null = null;
+ @Output() refreshNeedList = new EventEmitter<void>();
update(form: any) {
console.log(form);
@@ -50,7 +50,7 @@ export class NeedEditComponent {
(result) => {
if (result) {
console.log("need updated successfully");
- // this.needList?.refresh()
+ this.refreshNeedList.emit();
} else {
console.log("need update failed");
}