diff options
author | Joffrey BION <joffrey.bion@gmail.com> | 2019-05-05 12:53:49 +0200 |
---|---|---|
committer | jbion <joffrey.bion@amadeus.com> | 2019-05-06 18:33:14 +0200 |
commit | 47d4f119ac0b1c8cef55632ac1c40854556dcf37 (patch) | |
tree | d16d99705cafe584076f1f01a841a0aedc235aee | |
parent | Convert redux sagas to TypeScript (diff) | |
download | seven-wonders-47d4f119ac0b1c8cef55632ac1c40854556dcf37.tar.gz seven-wonders-47d4f119ac0b1c8cef55632ac1c40854556dcf37.tar.bz2 seven-wonders-47d4f119ac0b1c8cef55632ac1c40854556dcf37.zip |
Simplify store.js using react-devtools-extensions package
-rw-r--r-- | frontend/package.json | 1 | ||||
-rw-r--r-- | frontend/src/store.js | 11 | ||||
-rw-r--r-- | frontend/yarn.lock | 4 |
3 files changed, 8 insertions, 8 deletions
diff --git a/frontend/package.json b/frontend/package.json index cc3518ff..62936288 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -29,6 +29,7 @@ "react-router-redux": "^5.0.0-alpha.9", "react-transition-group": "^2.6.0", "redux": "^4.0.0", + "redux-devtools-extension": "^2.13.8", "redux-immutable": "^4.0.0", "redux-saga": "^0.16.0", "reflexbox": "^3.0.1", diff --git a/frontend/src/store.js b/frontend/src/store.js index 9c5a063b..2a5bf4bb 100644 --- a/frontend/src/store.js +++ b/frontend/src/store.js @@ -1,7 +1,8 @@ // @flow import createHistory from 'history/createBrowserHistory'; import { routerMiddleware } from 'react-router-redux'; -import { applyMiddleware, compose, createStore } from 'redux'; +import { applyMiddleware, createStore } from 'redux'; +import { composeWithDevTools } from 'redux-devtools-extension'; import createSagaMiddleware from 'redux-saga'; import type { GlobalState } from './reducers'; import { createReducer } from './reducers'; @@ -16,13 +17,7 @@ export function configureStore(initialState: GlobalState = {}) { const enhancers = [applyMiddleware(...middlewares)]; - 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, composeEnhancers(...enhancers)); + const store = createStore(createReducer(), initialState, composeWithDevTools(...enhancers)); sagaMiddleware.run(rootSaga); diff --git a/frontend/yarn.lock b/frontend/yarn.lock index 88ae9b91..9a57763a 100644 --- a/frontend/yarn.lock +++ b/frontend/yarn.lock @@ -7983,6 +7983,10 @@ recursive-readdir@2.2.2: dependencies: minimatch "3.0.4" +redux-devtools-extension@^2.13.8: + version "2.13.8" + resolved "https://registry.yarnpkg.com/redux-devtools-extension/-/redux-devtools-extension-2.13.8.tgz#37b982688626e5e4993ff87220c9bbb7cd2d96e1" + redux-immutable@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/redux-immutable/-/redux-immutable-4.0.0.tgz#3a1a32df66366462b63691f0e1dc35e472bbc9f3" |