diff options
author | sowgro <tpoke.ferrari@gmail.com> | 2025-04-05 14:37:01 -0400 |
---|---|---|
committer | sowgro <tpoke.ferrari@gmail.com> | 2025-04-05 14:37:01 -0400 |
commit | c2e7b170bfa0678a6ff4576d07388778f30084b0 (patch) | |
tree | 57fc334bea1bc15f8b971d499338497dd3fa7388 /ufund-ui/src/app/components/need-page/need-page.component.ts | |
parent | 7cedd8713d30fedcc9fc486a49d4804f37ab8765 (diff) | |
parent | 0103ffc6f84d04433943c644ab759c1d04b5e681 (diff) | |
download | JellySolutions-c2e7b170bfa0678a6ff4576d07388778f30084b0.tar.gz JellySolutions-c2e7b170bfa0678a6ff4576d07388778f30084b0.tar.bz2 JellySolutions-c2e7b170bfa0678a6ff4576d07388778f30084b0.zip |
Merge branch 'main' into need-image
# Conflicts:
# ufund-ui/src/app/components/need-list/need-list.component.ts
# ufund-ui/src/app/components/need-page/need-page.component.html
Diffstat (limited to 'ufund-ui/src/app/components/need-page/need-page.component.ts')
-rw-r--r-- | ufund-ui/src/app/components/need-page/need-page.component.ts | 31 |
1 files changed, 9 insertions, 22 deletions
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 ad4cacf..0967266 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,12 +1,12 @@ -import {Component, Input} from '@angular/core'; +import {Component, Input, OnInit} from '@angular/core'; import {GoalType, Need} from '../../models/Need'; import {ActivatedRoute, Router} from "@angular/router"; import {CupboardService} from "../../services/cupboard.service"; -import {userType} from '../../models/User'; import {AuthService} from '../../services/auth.service'; import {catchError, of} from 'rxjs'; import {ToastsService, ToastType} from '../../services/toasts.service'; import {UsersService} from '../../services/users.service'; +import {ModalService} from '../../services/modal.service'; @Component({ selector: 'app-need-page', @@ -14,18 +14,17 @@ import {UsersService} from '../../services/users.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, private authService: AuthService, - private usersService: UsersService, + protected usersService: UsersService, private toastService: ToastsService, - private router: Router + private router: Router, + protected modalService: ModalService ) {} - public GoalType = GoalType; - @Input() need!: Need; ngOnInit(): void { @@ -37,16 +36,6 @@ export class NeedPageComponent { window.history.back(); } - isManager() { - const type = this.authService.getCurrentUser()?.type; - return type === ("MANAGER" as unknown as userType); - } - - isHelper() { - const type = this.authService.getCurrentUser()?.type; - return type === ("HELPER" as unknown as userType); - } - add(need: Need) { const currentUser = this.authService.getCurrentUser(); //console.log("get current user in angular:", currentUser) @@ -69,19 +58,17 @@ 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) { - - } + readonly GoalType = GoalType } |