Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function configureStore(history, initialState = {}) {
const sagaMiddleware = createSagaMiddleware();
const reduxRouterMiddleware = routerMiddleware(history);
const middlewares = [sagaMiddleware, reduxRouterMiddleware];
const enhancers = [];
if (__CLIENT__ && __DEV__ && !window.__REDUX_DEVTOOLS_EXTENSION__) {
const { persistState } = require('redux-devtools').default;
const DevTools = require('./client/createDevTools').default;
enhancers.push(DevTools.instrument());
enhancers.push(
persistState(window.location.href.match(/[?&]debug_session=([^&#]+)\b/))
);
}
if (__CLIENT__ && window.__REDUX_DEVTOOLS_EXTENSION__) {
enhancers.push(window.__REDUX_DEVTOOLS_EXTENSION__());
}
const store = createStore(
createReducer(),
initialState,
compose(applyMiddleware(...middlewares), ...enhancers)
);