UNPKG

ngx-serial-route-guards

Version:

Collection of utility functions for executing functional Angular Route Guards serially.

20 lines (19 loc) 1.74 kB
import { CanActivateFn, CanActivateChildFn, ActivatedRouteSnapshot, RouterStateSnapshot, CanDeactivateFn, CanMatchFn, Route, UrlSegment } from '@angular/router'; /** * Runs the CanActivateFn route guards serially. * @param guards Route guards to be run serially. * @returns An observable that resolves to true if all guards are valid. Otherwise it returns the value from the first guard that failed. */ export declare const canActivateSerially: (guards: CanActivateFn[] | CanActivateChildFn[]) => (route: ActivatedRouteSnapshot, state: RouterStateSnapshot) => import("rxjs").Observable<boolean | import("@angular/router").UrlTree | import("@angular/router").RedirectCommand>; /** * Runs the CanMatchFn route guards serially. * @param guards Route guards to be run serially. * @returns An observable that resolves to true if all guards are valid. Otherwise it returns the value from the first guard that failed. */ export declare const canMatchSerially: (guards: CanMatchFn[]) => (route: Route, segments: UrlSegment[]) => import("rxjs").Observable<boolean | import("@angular/router").UrlTree | import("@angular/router").RedirectCommand>; /** * Runs the CanDeactivateFn route guards serially. * @param guards Route guards to be run serially. * @returns An observable that resolves to true if all guards are valid. Otherwise it returns the value from the first guard that failed. */ export declare const canDeactivateSerially: <TComponent>(guards: CanDeactivateFn<TComponent>[]) => (component: TComponent, currentRoute: ActivatedRouteSnapshot, currentState: RouterStateSnapshot, nextState: RouterStateSnapshot) => import("rxjs").Observable<boolean | import("@angular/router").UrlTree | import("@angular/router").RedirectCommand>;