mirror of
https://github.com/a-mayb3/KanbanCloneAngular.git
synced 2026-03-21 09:55:37 +01:00
33 lines
975 B
TypeScript
33 lines
975 B
TypeScript
import { Component, inject, OnInit } from '@angular/core';
|
|
import { CommonModule } from '@angular/common';
|
|
import { Router } from '@angular/router';
|
|
import { AuthService } from '../../services/auth.service';
|
|
import { ProjectItemComponent } from '../../components/project-item/project-item.component';
|
|
import { Project } from '../../models/projects.models';
|
|
|
|
@Component({
|
|
selector: 'app-home',
|
|
standalone: true,
|
|
imports: [CommonModule, ProjectItemComponent],
|
|
templateUrl: './home.component.html',
|
|
styleUrl: './home.component.css',
|
|
})
|
|
export class HomeComponent implements OnInit {
|
|
protected authService = inject(AuthService);
|
|
private router = inject(Router);
|
|
|
|
protected projects: Project[] = [];
|
|
|
|
ngOnInit(): void {
|
|
this.projects = this.authService.currentUser()?.projects ?? [];
|
|
}
|
|
|
|
onCreateProject() {
|
|
this.router.navigate(['/projects/new']);
|
|
}
|
|
|
|
trackByProjectId(_index: number, project: Project): number {
|
|
return project.id;
|
|
}
|
|
|
|
}
|