import { Injectable } from '@angular/core';
import { CanActivate } from '@angular/router';
import { DossierTemplatesService } from '@services/dossier-templates/dossier-templates.service';
import { firstValueFrom } from 'rxjs';

@Injectable({ providedIn: 'root' })
export class DossierTemplatesGuard implements CanActivate {
    constructor(private readonly _dossierTemplatesService: DossierTemplatesService) {}

    async canActivate(): Promise<boolean> {
        await firstValueFrom(this._dossierTemplatesService.loadAll());
        return true;
    }
}
