Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function createStore(reducer) {
const enhancer = compose(
applyMiddleware(
thunkMiddleware,
...(process.env.NODE_ENV === "production"
? // eslint-disable-next-line global-require
[require("redux-freeze")]
: []),
),
persistToLocalStorage("theme"),
devToolsEnhancer({ title: "Sensu Web UI" }),
);
return create(reducer, enhancer);
}
middleware as routerMiddleware,
reducer as routerReducer,
} from './routing';
import sagas from './sagas';
const saga = createSagaMiddleware();
export const store = createStore(
combineReducers({
...reducers,
router: routerReducer,
}),
compose(
routerEnhancer,
applyMiddleware(routerMiddleware, saga),
devToolsEnhancer({}),
),
);
for (const s of sagas) {
saga.run(s);
}
store.dispatch(generateInstanceId());
store.dispatch(initializeCurrentLocation(store.getState().router));
window.onSpotifyWebPlaybackSDKReady = () => {
store.dispatch(spotifySdkInitFinish());
};
import thunk from 'redux-thunk';
import { offline } from 'redux-offline';
import offlineConfig from 'redux-offline/lib/defaults';
import { devToolsEnhancer } from 'redux-devtools-extension/logOnlyInProduction';
import rootReducer from './reducers';
import App from './components/App';
import defaultState from './defaultState.js';
const middleware = [thunk, promiseMiddleware];
const enhancer = compose(
applyMiddleware(...middleware),
devToolsEnhancer(),
offline(offlineConfig)
);
const store = createStore(rootReducer, defaultState, enhancer);
ReactDOM.render(
,
document.getElementById('root')
);