How to use the routes.Router.pushRoute function in routes

To help you get started, we’ve selected a few routes examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github reactioncommerce / example-storefront / src / pages / auth.js View on Github external
setToken() {
    // parse the url params from Keycloak
    const params = this.getUrlParams();

    if (typeof window !== "undefined" && params.access_token) {
      const { keycloakAuthStore } = this.props;

      keycloakAuthStore.setToken(params.access_token);

      const previousRoute = localStorage.getItem("kc-redirected-from");
      localStorage.removeItem("kc-redirected-from");
      Router.pushRoute(previousRoute || "/");
    }
  }
github reactioncommerce / example-storefront / src / components / SearchInput / SearchInput.js View on Github external
function handleSearch({ keyCode, target }) {
  // Send user to grid page when the enter key is pressed.
  // The current search string will be appended to the URL as a query param.
  if (keyCode === 13) {
    const { value } = target;
    const route = value === "" ? "/" : `/?search=${value}`;
    Router.pushRoute(route);
  }
}
github resource-watch / resource-watch / pages / app / ExploreDetailPrivate.js View on Github external
handleTagSelected(tag, labels = ['TOPIC']) { // eslint-disable-line class-methods-use-this
    const tagSt = `["${tag}"]`;
    let treeSt = 'topics';
    if (labels.includes('TOPIC')) {
      treeSt = 'topics';
    } else if (labels.includes('GEOGRAPHY')) {
      treeSt = 'geographies';
    } else if (labels.includes('DATA_TYPE')) {
      treeSt = 'dataType';
    }

    Router.pushRoute('explore', { [treeSt]: tagSt });
  }
github reactioncommerce / example-storefront / src / components / NavigationMobile / NavigationItemMobile.js View on Github external
onClick = () => {
    const { navItem } = this.props;

    if (this.hasSubNavItems) {
      this.setState({ isSubNavOpen: !this.state.isSubNavOpen });
    } else {
      const path = this.linkPath;
      Router.pushRoute(path, { slug: navItem.slug });
    }
  };

routes

Minimalist route matching for javascript

Unknown
Latest version published 9 years ago

Package Health Score

51 / 100
Full package analysis