mirror of
https://github.com/Kong/insomnia
synced 2024-11-08 06:39:48 +00:00
27 lines
727 B
JavaScript
27 lines
727 B
JavaScript
|
import { createStore, applyMiddleware } from 'redux'
|
||
|
import thunkMiddleware from 'redux-thunk'
|
||
|
import createLogger from 'redux-logger'
|
||
|
import rootReducer from '../reducers'
|
||
|
|
||
|
const loggerMiddleware = createLogger();
|
||
|
|
||
|
export default function configureStore (initialState) {
|
||
|
const store = createStore(
|
||
|
rootReducer,
|
||
|
initialState,
|
||
|
applyMiddleware(
|
||
|
thunkMiddleware,
|
||
|
loggerMiddleware
|
||
|
)
|
||
|
);
|
||
|
|
||
|
if (module.hot) {
|
||
|
// Enable Webpack hot module replacement for reducers
|
||
|
module.hot.accept('../reducers', () => {
|
||
|
const nextReducer = require('../reducers').default;
|
||
|
store.replaceReducer(nextReducer);
|
||
|
})
|
||
|
}
|
||
|
|
||
|
return store
|
||
|
}
|