2015-10-17 04:11:16 +03:00
|
|
|
import { createStore, compose } from 'redux';
|
|
|
|
import { persistState } from 'redux-devtools';
|
|
|
|
import rootReducer from '../reducers';
|
|
|
|
import DevTools from '../containers/DevTools';
|
|
|
|
|
2016-01-28 22:13:55 +03:00
|
|
|
const enhancer = compose(
|
2015-10-17 04:11:16 +03:00
|
|
|
DevTools.instrument(),
|
|
|
|
persistState(
|
|
|
|
window.location.href.match(
|
|
|
|
/[?&]debug_session=([^&]+)\b/
|
|
|
|
)
|
|
|
|
)
|
2016-01-28 22:13:55 +03:00
|
|
|
);
|
2015-10-17 04:11:16 +03:00
|
|
|
|
|
|
|
export default function configureStore(initialState) {
|
2016-01-28 22:13:55 +03:00
|
|
|
const store = createStore(rootReducer, initialState, enhancer);
|
2015-10-17 04:11:16 +03:00
|
|
|
|
|
|
|
if (module.hot) {
|
|
|
|
module.hot.accept('../reducers', () =>
|
2015-12-27 03:31:56 +03:00
|
|
|
store.replaceReducer(require('../reducers').default)
|
2015-10-17 04:11:16 +03:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
return store;
|
|
|
|
}
|