UNPKG

@bi8/am-uaa

Version:

ng update @angular/cli yarn add @angular/cli

21 lines (17 loc) 658 B
import {Injectable} from "@angular/core"; import {Resolve, ActivatedRouteSnapshot, RouterStateSnapshot} from '@angular/router'; import {UaaService} from "./uaa.service"; import {Observable, Observer} from "rxjs"; @Injectable() export class IdentityResolver implements Resolve<any> { constructor(private uaaService: UaaService) { } resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<any> { return Observable.create((observer: Observer<any[]>) => { this.uaaService.getIdentity(true).subscribe(identity => { observer.next(identity); observer.complete(); }); }); } }