Skip to content

Instantly share code, notes, and snippets.

@maximgatilin
Created August 10, 2018 05:35
Show Gist options
  • Select an option

  • Save maximgatilin/ff2c20683dc8b1782a0b3a7b494134a7 to your computer and use it in GitHub Desktop.

Select an option

Save maximgatilin/ff2c20683dc8b1782a0b3a7b494134a7 to your computer and use it in GitHub Desktop.
import {replace} from 'react-router-redux';
export default store => next => action => {
if (action.pushToUrl) {
const state = store.getState();
store.dispatch(replace({
pathname: state.routing.locationBeforeTransitions.pathname,
query: {
...state.routing.locationBeforeTransitions.query,
...action.pushToUrl
}
}));
}
return next(action);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment