changes are done
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
import { Component, OnInit, signal } from '@angular/core';
|
||||
import { Component, OnInit, signal, DestroyRef, inject } from '@angular/core';
|
||||
import { Router } from '@angular/router';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { MatCardModule } from '@angular/material/card';
|
||||
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
||||
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
||||
import { ApiService } from '../../services';
|
||||
import { Project } from '../../models';
|
||||
import { LanguageService } from '../../services/language.service';
|
||||
@@ -21,6 +22,8 @@ export class ProjectsDashboardComponent implements OnInit {
|
||||
error = signal<string | null>(null);
|
||||
currentProjectId = signal<string | null>(null);
|
||||
|
||||
private destroyRef = inject(DestroyRef);
|
||||
|
||||
constructor(
|
||||
private apiService: ApiService,
|
||||
private router: Router,
|
||||
@@ -37,7 +40,7 @@ export class ProjectsDashboardComponent implements OnInit {
|
||||
}
|
||||
|
||||
// Listen to route changes
|
||||
this.router.events.subscribe(() => {
|
||||
this.router.events.pipe(takeUntilDestroyed(this.destroyRef)).subscribe(() => {
|
||||
const segments = this.router.url.split('/');
|
||||
if (segments[1] === 'project' && segments[2]) {
|
||||
this.currentProjectId.set(segments[2]);
|
||||
|
||||
Reference in New Issue
Block a user