2016-06-10 00:41:40 +02:00
|
|
|
import { createStore, applyMiddleware, compose } from 'redux'
|
|
|
|
import thunk from 'redux-thunk'
|
2016-05-05 23:48:26 +02:00
|
|
|
import rootReducer from '../reducers'
|
|
|
|
|
|
|
|
export default function configureStore(initialState) {
|
|
|
|
const store = createStore(
|
|
|
|
rootReducer,
|
2016-06-10 00:41:40 +02:00
|
|
|
initialState,
|
|
|
|
applyMiddleware(thunk)
|
2016-05-05 23:48:26 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
if (module.hot) {
|
|
|
|
// Enable Webpack hot module replacement for reducers
|
|
|
|
module.hot.accept('../reducers', () => {
|
|
|
|
const nextRootReducer = require('../reducers').default
|
|
|
|
store.replaceReducer(nextRootReducer)
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
return store
|
|
|
|
}
|