You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
810 B
28 lines
810 B
import { createStore, applyMiddleware, compose } from 'redux'
|
|
import thunk from 'redux-thunk'
|
|
import { createBrowserHistory } from 'history'
|
|
import { routerMiddleware } from 'react-router-redux'
|
|
import rootReducer from '../reducers'
|
|
import ipc from '../reducers/ipc'
|
|
|
|
const middleware = []
|
|
const enhancers = []
|
|
|
|
middleware.push(thunk)
|
|
|
|
const history = createBrowserHistory()
|
|
|
|
const router = routerMiddleware(history)
|
|
middleware.push(router)
|
|
|
|
console.log('middleware: ', middleware)
|
|
enhancers.push(applyMiddleware(...middleware, ipc))
|
|
console.log('ENHANCERS: ', enhancers)
|
|
const enhancer = compose(...enhancers)
|
|
// const enhancer = applyMiddleware(thunk, router);
|
|
|
|
function configureStore(initialState) {
|
|
return createStore(rootReducer, initialState, enhancer);
|
|
}
|
|
|
|
export default { configureStore, history };
|
|
|