Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | 13x 13x 9x 13x 13x 13x | import type { RouterStateSnapshot } from '@angular/router';
import type { RouterStateSerializer } from '@ngrx/router-store';
import type { IRouterStateModel } from './router.interface';
/**
* Returns an object with a partial router state instead of the full router state snapshot.
*/
export class AppRouteSerializer implements RouterStateSerializer<IRouterStateModel> {
public serialize(routerState: RouterStateSnapshot): IRouterStateModel {
let root = routerState.root;
while (root.firstChild) {
root = root.firstChild;
}
const {
url,
root: { queryParams },
} = routerState;
const { params, data } = root;
return { url, params, queryParams, data, root: {} };
}
}
|