insomnia/app/ui/redux/create.js

22 lines
566 B
JavaScript
Raw Normal View History

import {createStore, applyMiddleware} from 'redux';
import thunkMiddleware from 'redux-thunk';
import {reducer} from './modules';
2016-04-29 05:58:37 +00:00
2016-04-29 03:37:49 +00:00
export default function configureStore () {
const middleware = [thunkMiddleware];
2016-04-29 05:58:37 +00:00
if (__DEV__) {
2016-12-05 22:42:40 +00:00
// const createLogger = require('redux-logger');
// middleware.push(createLogger({collapsed: true}));
2016-04-29 05:58:37 +00:00
}
const store = createStore(reducer, applyMiddleware(...middleware));
if (__DEV__ && module.hot) {
module.hot.accept('./modules/index', () => {
store.replaceReducer(reducer);
});
2016-03-20 04:00:40 +00:00
}
2016-03-16 05:49:42 +00:00
return store;
2016-03-20 04:00:40 +00:00
}