You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
planka_custom/client/src/lib/redux-router/create-router-middleware.js

19 lines
404 B
JavaScript

import { HISTORY_METHOD_CALL } from './actions';
const createRouterMiddleware = (history) => {
// eslint-disable-next-line consistent-return
return () => (next) => (action) => {
if (action.type !== HISTORY_METHOD_CALL) {
return next(action);
}
const {
payload: { method, args },
} = action;
history[method](...args);
};
};
export default createRouterMiddleware;