import { Injectable } from '@angular/core' ; import { Resolve , ActivatedRouteSnapshot } from '@angular/router' ; import { StoreService } from '../../store/store.service' ; import { TokenData , TokenService } from '../../shared/services/token.service' ; @ Injectable ( ) export class TokenDataResolver implements Resolve < Promise < TokenData > > { constructor ( private tokenService , private storeService ) { } async resolve ( route ) { const currentAccount = await this . storeService . getSelectedAccount ( ) ; return this . tokenService . fetchTokenData ( route . paramMap . get ( 'id' ) , currentAccount ) ; } }