diff options
author | Victor Chabbert <chabbertvi@eisti.eu> | 2016-12-18 18:06:04 +0100 |
---|---|---|
committer | Victor Chabbert <chabbertvi@eisti.eu> | 2016-12-18 18:06:04 +0100 |
commit | ef8dcf4313b8ef47a364e10d7014ea2c1a728a00 (patch) | |
tree | 475661e209c2f6332542eceb4287dbdb4847145c /src/main | |
parent | Add react-router with small example (diff) | |
download | seven-wonders-ef8dcf4313b8ef47a364e10d7014ea2c1a728a00.tar.gz seven-wonders-ef8dcf4313b8ef47a364e10d7014ea2c1a728a00.tar.bz2 seven-wonders-ef8dcf4313b8ef47a364e10d7014ea2c1a728a00.zip |
Update redux-devtools extension integration
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/js/src/index.js | 4 | ||||
-rw-r--r-- | src/main/js/src/store.js | 11 |
2 files changed, 7 insertions, 8 deletions
diff --git a/src/main/js/src/index.js b/src/main/js/src/index.js index 31ddded9..cfe654b5 100644 --- a/src/main/js/src/index.js +++ b/src/main/js/src/index.js @@ -7,10 +7,6 @@ import configureStore from './store' const initialState = {} const store = configureStore(initialState) -if (window.devToolsExtension) { - window.devToolsExtension.updateStore(store) -} - import './index.css' import App from './containers/App' diff --git a/src/main/js/src/store.js b/src/main/js/src/store.js index 8cf7fa21..d4885275 100644 --- a/src/main/js/src/store.js +++ b/src/main/js/src/store.js @@ -2,19 +2,22 @@ import { createStore, compose } from 'redux' import createReducer from './reducers' -const devtools = window.devToolsExtension || (() => noop => noop) - export default function configureStore(initialState = {}) { const middlewares = [] const enhancers = [ - devtools() ] + const composeEnhancers = + process.env.NODE_ENV !== 'production' && + typeof window === 'object' && + window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ ? + window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ : compose; + const store = createStore( createReducer(), initialState, - compose(...enhancers) + composeEnhancers(...enhancers) ) return store |