import { Injectable } from '@angular/core' ; import { ActivatedRouteSnapshot , Resolve } from '@angular/router' ; import { of , Observable } from 'rxjs' ; import { catchError , take } from 'rxjs/operators' ; import { TokenService } from '@core/services/index.service' ; import { TokenModel } from '@shared/models/index.model' ; @ Injectable ( { providedIn : 'root' , } ) export class TokensResolver implements Resolve < TokenModel [ ] > { param tokenService constructor ( private tokenService ) { } param route resolve ( route ) { return this . tokenService . findAll ( route . params . projectUid ) . pipe ( take ( 1 ) , catchError ( ( ) => of ( [ ] ) ) ) ; } }