store.js 786 B

12345678910111213141516171819202122232425
  1. import { createStore, applyMiddleware } from 'redux';
  2. import { forwardToRenderer, replayActionMain } from 'electron-redux';
  3. import { composeWithDevTools } from 'remote-redux-devtools';
  4. import thunk from 'redux-thunk';
  5. import { app } from 'electron';
  6. import rootReducer from './rootReducer';
  7. export default function configureReduxStore() {
  8. // In development, send Redux actions to a local DevTools server
  9. // Note: run and view these DevTools with `yarn dev:tools`
  10. let debugWrapper = data => data;
  11. if (process.env.NODE_ENV === 'development') {
  12. debugWrapper = composeWithDevTools({ realtime: true, port: 8000 });
  13. }
  14. const store = createStore(
  15. rootReducer,
  16. debugWrapper(applyMiddleware(thunk, forwardToRenderer))
  17. );
  18. replayActionMain(store);
  19. return store;
  20. }