This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { createStore, applyMiddleware } from 'redux'; | |
import appMiddleware from './middlewares'; | |
import reducer from './reducer'; | |
const history = { push: () => {}, location: { pathname: '/' } }; | |
const getStore = (middlewares, initialState) => { | |
let actions = []; | |
const store = createStore( | |
reducer, | |
initialState, | |
applyMiddleware( | |
...appMiddleware( | |
{ | |
history, | |
...middlewares, | |
}, | |
false, | |
), | |
() => next => action => { | |
if (action.type) { | |
actions.push(action); | |
} | |
return next(action); | |
}, | |
), | |
); | |
store.getActions = () => { | |
return actions; | |
}; | |
return store; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment