2018-12-22 17:20:04 +03:00
|
|
|
import { createStore, compose } from 'redux';
|
|
|
|
import { persistState } from 'redux-devtools';
|
|
|
|
import rootReducer from '../reducers';
|
|
|
|
import DevTools from '../containers/DevTools';
|
|
|
|
|
|
|
|
const finalCreateStore = compose(
|
|
|
|
DevTools.instrument(),
|
2019-01-10 21:51:14 +03:00
|
|
|
persistState(window.location.href.match(/[?&]debug_session=([^&]+)\b/))
|
2018-12-22 17:20:04 +03:00
|
|
|
)(createStore);
|
|
|
|
|
|
|
|
export default function configureStore(initialState) {
|
|
|
|
const store = finalCreateStore(rootReducer, initialState);
|
|
|
|
|
|
|
|
if (module.hot) {
|
|
|
|
module.hot.accept('../reducers', () => store.replaceReducer(rootReducer));
|
|
|
|
}
|
|
|
|
|
|
|
|
return store;
|
|
|
|
}
|