Example #1
0
  pushRoute(route_name, action, payload){
    let router = this,
        route = router.routes.getRoute(route_name);

    action = {
      type: action ? action.getType() : updateLocation.getType(),
      payload: payload,
      no_scroll: payload ? payload.no_scroll : false
    };

    router.pushHistory({
      pathname: route.url(action, router.i18n),
      state: action
    });
  }
Example #2
0
/*global window*/

import queryString from 'query-string';
import extend from 'extend';

import { updateLocation } from 'shared/reducers/location/location.actions';
import { defineRoutes } from '../routes';

const NON_MAIN_ROUTES = ['Settings', 'MissingRoute', 'ForgotPassword'];

const DEFAULT_UPDATE_LOCATION_ACTION = {
  type: updateLocation.getType(),
  payload: {}
};

export default class Router {

  constructor(i18n, routes) {
    let router = this;

    router.i18n = i18n;
    router.routes = routes || Router.routes(i18n);

    router.update_in_progress = true;
  }

  get default_update_location_action(){
    return extend(true, {}, DEFAULT_UPDATE_LOCATION_ACTION);
  }

  get current_route(){