From feba88fed855d1694d292e401a4cb336e0ff9d69 Mon Sep 17 00:00:00 2001 From: sowgro Date: Fri, 4 Apr 2025 20:56:02 -0400 Subject: Fix create-need dialog --- .../src/app/components/need-page/need-page.component.ts | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) (limited to 'ufund-ui/src/app/components/need-page/need-page.component.ts') diff --git a/ufund-ui/src/app/components/need-page/need-page.component.ts b/ufund-ui/src/app/components/need-page/need-page.component.ts index e9be093..1c6d8e4 100644 --- a/ufund-ui/src/app/components/need-page/need-page.component.ts +++ b/ufund-ui/src/app/components/need-page/need-page.component.ts @@ -1,5 +1,5 @@ -import {Component, Input} from '@angular/core'; -import {GoalType, Need} from '../../models/Need'; +import {Component, Input, OnInit} from '@angular/core'; +import {Need} from '../../models/Need'; import {ActivatedRoute, Router} from "@angular/router"; import {CupboardService} from "../../services/cupboard.service"; import {userType} from '../../models/User'; @@ -15,7 +15,7 @@ import {ModalService} from '../../services/modal.service'; templateUrl: './need-page.component.html', styleUrl: './need-page.component.css' }) -export class NeedPageComponent { +export class NeedPageComponent implements OnInit { constructor( private route: ActivatedRoute, private cupboardService: CupboardService, @@ -26,8 +26,6 @@ export class NeedPageComponent { protected modalService: ModalService ) {} - public GoalType = GoalType; - @Input() need!: Need; ngOnInit(): void { @@ -71,19 +69,15 @@ export class NeedPageComponent { delete(id : number) { this.cupboardService.deleteNeed(id) - .pipe(catchError((ex, r) => { + .pipe(catchError((ex, _) => { this.toastService.sendToast(ToastType.ERROR, ex.error) return of() })) .subscribe(() => { // this.needs = this.needs.filter(n => n.id !== id) this.toastService.sendToast(ToastType.INFO, "Need deleted") - this.router.navigate(['/']) + this.router.navigate(['/cupboard']) }) // this.refresh(); } - - edit(need: Need) { - - } } -- cgit v1.2.3