Skip to content
This repository has been archived by the owner on Jul 27, 2018. It is now read-only.

Add query params to RouterState #56

Open
YoussefTaghlabi opened this issue Nov 2, 2017 · 0 comments
Open

Add query params to RouterState #56

YoussefTaghlabi opened this issue Nov 2, 2017 · 0 comments

Comments

@YoussefTaghlabi
Copy link

Currently, RouterState hosts only a path; It will be nice if it can host a queryParams object and enhance connectRouterActions to dispatch it.

// reducer.ts
export interface RouterState {
  path: string;
  queryParams: any;
}

// connect.ts
export function getQueryParams(router: Router): Observable<any> {
  // Get query params from router
  const queryParams  = ... ;
  return queryParams;
}


export function connectRouterActions(router: Router, store: Store<any>) {
  const queryParams = getQueryParams(router);
  ...
    return { type: routerActions.UPDATE_LOCATION, payload: { path, queryParams }};
 ....
}
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant