import { Action } from '@ngrx/store' ; import { NavigationExtras } from '@angular/router' ; export interface RouterMethodCall { path ? : string | any [ ] ; query ? : any ; extras ? : NavigationExtras ; } export const routerActions = { GO : '[Router] Go' , REPLACE : '[Router] Replace' , SEARCH : '[Router] Search' , SHOW : '[Router] Show' , BACK : '[Router] Back' , FORWARD : '[Router] Forward' , UPDATE_LOCATION : '[Router] Update Location' } ; export const routerActionTypes = Object . keys ( routerActions ) . map ( key => routerActions [ key ] ) ; export function go ( path , query ? , extras ? ) { const payload = { path , query , extras } ; return { type : routerActions . GO , payload } ; } export function replace ( path , query ? , extras ? ) { const payload = { path , query , extras } ; return { type : routerActions . REPLACE , payload } ; } export function search ( query , extras ? ) { const payload = { query , extras } ; return { type : routerActions . SEARCH , payload } ; } export function show ( path , query ? , extras ? ) { const payload = { path , query , extras } ; return { type : routerActions . SHOW , payload } ; } export function back ( ) { const payload = { } ; return { type : routerActions . BACK , payload } ; } export function forward ( ) { const payload = { } ; return { type : routerActions . FORWARD , payload } ; }