import { MsgState } from 'src/app/ngrx/msg.state'; import { Store } from '@ngrx/store'; import { Router } from '@angular/router'; import { Project } from './../../../../shared/models/project/project.model'; import { ProjectState } from './../../../../ngrx/projects/project.state'; import { Component, Input, OnInit } from '@angular/core'; import { DeleteProjectAction } from 'src/app/ngrx/projects/projects.actions'; @Component({ selector: 'app-projects-list', templateUrl: './projects-list.component.html', styleUrls: ['./projects-list.component.css'], }) export class ProjectsListComponent implements OnInit { constructor( private router: Router, private store: Store<{ projectReducerKey: ProjectState }> ) {} @Input() inputProjectState!: ProjectState; ngOnInit(): void {} onEditProject(project: Project) { this.router.navigate(['/project-update/' + project.id]); } onProjectDelete(project: Project) { if(window.confirm(MsgState.CONFIRM_DEL)){ this.store.dispatch(new DeleteProjectAction(project)); } } }