aboutsummaryrefslogtreecommitdiff
path: root/ufund-ui/src/app/components/cupboard/cupboard.component.ts
diff options
context:
space:
mode:
authorsowgro <tpoke.ferrari@gmail.com>2025-03-17 23:04:57 -0400
committersowgro <tpoke.ferrari@gmail.com>2025-03-17 23:04:57 -0400
commit275a6062007380389b7a8f1b8958e8033b4f0925 (patch)
treeea82680547ec109627f6ff91c6015128e4e3f19b /ufund-ui/src/app/components/cupboard/cupboard.component.ts
parent2b847078b7af4ade35461b8af52352bc88994be3 (diff)
downloadJellySolutions-275a6062007380389b7a8f1b8958e8033b4f0925.tar.gz
JellySolutions-275a6062007380389b7a8f1b8958e8033b4f0925.tar.bz2
JellySolutions-275a6062007380389b7a8f1b8958e8033b4f0925.zip
Auto refresh needs on change
Diffstat (limited to 'ufund-ui/src/app/components/cupboard/cupboard.component.ts')
-rw-r--r--ufund-ui/src/app/components/cupboard/cupboard.component.ts11
1 files changed, 7 insertions, 4 deletions
diff --git a/ufund-ui/src/app/components/cupboard/cupboard.component.ts b/ufund-ui/src/app/components/cupboard/cupboard.component.ts
index 1b6d658..9574de3 100644
--- a/ufund-ui/src/app/components/cupboard/cupboard.component.ts
+++ b/ufund-ui/src/app/components/cupboard/cupboard.component.ts
@@ -4,6 +4,7 @@ import { UsersService } from '../../services/users.service';
import { Need, GoalType } from '../../models/Need';
import { userType } from '../../models/User';
import { BehaviorSubject, catchError, of } from 'rxjs';
+import {NeedListComponent} from '../need-list/need-list.component';
@Component({
selector: 'app-cupboard',
@@ -16,7 +17,9 @@ export class CupboardComponent implements OnInit {
protected statusText = new BehaviorSubject("")
-needs: any;
+ needs: any;
+ @ViewChild("needList") needList?: NeedListComponent
+
constructor(private cupboardService: CupboardService, private usersService: UsersService) { }
ngOnInit(): void {
@@ -110,7 +113,7 @@ needs: any;
(result) => {
if (result) {
console.log("need updated successfully");
- location.reload();
+ this.needList?.refresh()
} else {
console.log("need update failed");
}
@@ -139,7 +142,7 @@ needs: any;
(result) => {
if (result) {
console.log("need created successfully");
- location.reload();
+ this.needList?.refresh()
} else {
console.log("need creation failed");
}
@@ -195,4 +198,4 @@ let friendlyHttpStatus: {[key: number]: string} = {
503: 'Service Unavailable',
504: 'Gateway Timeout',
505: 'HTTP Version Not Supported',
-}; \ No newline at end of file
+};