diff options
author | Victor Chabbert <chabbertvi@eisti.eu> | 2017-07-25 00:09:31 +0200 |
---|---|---|
committer | Victor Chabbert <chabbertvi@eisti.eu> | 2017-08-07 22:41:20 +0200 |
commit | 3b1e1a77dbf93f5312f90b6545a1f34b5b609792 (patch) | |
tree | ff479637adcf67ac75894f81189bb2604f6e17ab /frontend | |
parent | Remove redux-saga-router (diff) | |
download | seven-wonders-3b1e1a77dbf93f5312f90b6545a1f34b5b609792.tar.gz seven-wonders-3b1e1a77dbf93f5312f90b6545a1f34b5b609792.tar.bz2 seven-wonders-3b1e1a77dbf93f5312f90b6545a1f34b5b609792.zip |
Updrade react router and react router redux
Diffstat (limited to 'frontend')
-rw-r--r-- | frontend/package.json | 5 | ||||
-rw-r--r-- | frontend/src/index.js | 12 | ||||
-rw-r--r-- | frontend/src/store.js | 17 | ||||
-rw-r--r-- | frontend/yarn.lock | 68 |
4 files changed, 60 insertions, 42 deletions
diff --git a/frontend/package.json b/frontend/package.json index 0c18837e..2378ae62 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -10,14 +10,15 @@ "react-scripts": "^1.0.7" }, "dependencies": { + "history": "^4.6.3", "immutable": "^3.8.1", "normalizr": "^3.2.3", "react": "^15.5.4", "react-dom": "^15.5.4", "react-redux": "^5.0.1", "react-redux-toastr": "^6.2.6", - "react-router": "^3.0.2", - "react-router-redux": "^4.0.8", + "react-router-dom": "^4.1.2", + "react-router-redux": "next", "rebass": "^0.3.3", "redux": "^3.6.0", "redux-immutable": "^4.0.0", diff --git a/frontend/src/index.js b/frontend/src/index.js index 17076de5..2dc2442c 100644 --- a/frontend/src/index.js +++ b/frontend/src/index.js @@ -2,19 +2,23 @@ import 'babel-polyfill'; import React from 'react'; import ReactDOM from 'react-dom'; +import { ConnectedRouter } from 'react-router-redux'; +import { Route, Switch } from 'react-router'; import { Provider } from 'react-redux'; -import { Router } from 'react-router'; import './global-styles.css'; -import { routes } from './routes'; import configureStore from './store'; - +import HomePage from './containers/home'; const initialState = {}; const { store, history } = configureStore(initialState); ReactDOM.render( <Provider store={store}> - <Router history={history} routes={routes} /> + <ConnectedRouter history={history}> + <Switch> + <Route path="/" component={HomePage} /> + </Switch> + </ConnectedRouter> </Provider>, document.getElementById('root') ); diff --git a/frontend/src/store.js b/frontend/src/store.js index 47b2073e..37bc0822 100644 --- a/frontend/src/store.js +++ b/frontend/src/store.js @@ -1,17 +1,18 @@ // @flow +import { createStore, applyMiddleware, compose } from 'redux'; +import createHistory from 'history/createBrowserHistory'; +import { routerMiddleware } from 'react-router-redux'; import { fromJS } from 'immutable'; -import { browserHistory } from 'react-router'; -import { routerMiddleware, syncHistoryWithStore } from 'react-router-redux'; -import { applyMiddleware, compose, createStore } from 'redux'; import createSagaMiddleware from 'redux-saga'; import createReducer from './reducers'; -import { makeSelectLocationState } from './redux/app'; import rootSaga from './sagas'; export default function configureStore(initialState: Object = {}) { const sagaMiddleware = createSagaMiddleware(); - const middlewares = [sagaMiddleware, routerMiddleware(browserHistory)]; + const history = createHistory(); + + const middlewares = [sagaMiddleware, routerMiddleware(history)]; const enhancers = [applyMiddleware(...middlewares)]; @@ -23,12 +24,10 @@ export default function configureStore(initialState: Object = {}) { const store = createStore(createReducer(), fromJS(initialState), composeEnhancers(...enhancers)); - sagaMiddleware.run(rootSaga, browserHistory); + sagaMiddleware.run(rootSaga, history); return { store, - history: syncHistoryWithStore(browserHistory, store, { - selectLocationState: makeSelectLocationState(), - }), + history, }; } diff --git a/frontend/yarn.lock b/frontend/yarn.lock index eefab282..1a34901d 100644 --- a/frontend/yarn.lock +++ b/frontend/yarn.lock @@ -1589,14 +1589,6 @@ create-hmac@^1.1.0, create-hmac@^1.1.2, create-hmac@^1.1.4: safe-buffer "^5.0.1" sha.js "^2.4.8" -create-react-class@^15.5.1: - version "15.5.3" - resolved "https://registry.yarnpkg.com/create-react-class/-/create-react-class-15.5.3.tgz#fb0f7cae79339e9a179e194ef466efa3923820fe" - dependencies: - fbjs "^0.8.9" - loose-envify "^1.3.1" - object-assign "^4.1.1" - cross-spawn@4.0.2: version "4.0.2" resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-4.0.2.tgz#7b9247621c23adfdd3856004a823cbe397424d41" @@ -2869,13 +2861,14 @@ he@1.1.x: version "1.1.0" resolved "https://registry.yarnpkg.com/he/-/he-1.1.0.tgz#29319d49beec13a9b1f3c4f9b2a6dde4859bb2a7" -history@^3.0.0: - version "3.3.0" - resolved "https://registry.yarnpkg.com/history/-/history-3.3.0.tgz#fcedcce8f12975371545d735461033579a6dae9c" +history@^4.5.1, history@^4.6.0, history@^4.6.3: + version "4.6.3" + resolved "https://registry.yarnpkg.com/history/-/history-4.6.3.tgz#6d723a8712c581d6bef37e8c26f4aedc6eb86967" dependencies: invariant "^2.2.1" loose-envify "^1.2.0" - query-string "^4.2.2" + resolve-pathname "^2.0.0" + value-equal "^0.2.0" warning "^3.0.0" hmac-drbg@^1.0.0: @@ -4287,7 +4280,7 @@ oauth-sign@~0.8.1: version "0.8.2" resolved "https://registry.yarnpkg.com/oauth-sign/-/oauth-sign-0.8.2.tgz#46a6ab7f0aead8deae9ec0565780b7d4efeb9d43" -object-assign@4.1.1, object-assign@^4.1.1: +object-assign@4.1.1: version "4.1.1" resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" @@ -4508,7 +4501,7 @@ path-to-regexp@0.1.7: version "0.1.7" resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-0.1.7.tgz#df604178005f522f15eb4490e7247a1bfaa67f8c" -path-to-regexp@^1.0.1: +path-to-regexp@^1.0.1, path-to-regexp@^1.5.3: version "1.7.0" resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-1.7.0.tgz#59fde0f435badacba103a84e9d3bc64e96b9937d" dependencies: @@ -4960,7 +4953,7 @@ promise@7.1.1, promise@^7.1.1: dependencies: asap "~2.0.3" -prop-types@^15.5.6, prop-types@^15.5.7, prop-types@~15.5.7: +prop-types@^15.5.4, prop-types@^15.5.7, prop-types@~15.5.7: version "15.5.10" resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.5.10.tgz#2797dfc3126182e3a95e3dfbb2e893ddd7456154" dependencies: @@ -5021,7 +5014,7 @@ qs@~6.3.0: version "6.3.0" resolved "https://registry.yarnpkg.com/qs/-/qs-6.3.0.tgz#f403b264f23bc01228c74131b407f18d5ea5d442" -query-string@^4.1.0, query-string@^4.2.2: +query-string@^4.1.0: version "4.2.3" resolved "https://registry.yarnpkg.com/query-string/-/query-string-4.2.3.tgz#9f27273d207a25a8ee4c7b8c74dcd45d556db822" dependencies: @@ -5136,20 +5129,33 @@ react-redux@^5.0.1: lodash-es "^4.2.0" loose-envify "^1.1.0" -react-router-redux@^4.0.8: - version "4.0.8" - resolved "https://registry.yarnpkg.com/react-router-redux/-/react-router-redux-4.0.8.tgz#227403596b5151e182377dab835b5d45f0f8054e" +react-router-dom@^4.1.2: + version "4.1.2" + resolved "https://registry.yarnpkg.com/react-router-dom/-/react-router-dom-4.1.2.tgz#7f8a7ca868d32acadd19ca09543b40d26df8ec37" + dependencies: + history "^4.5.1" + loose-envify "^1.3.1" + prop-types "^15.5.4" + react-router "^4.1.1" -react-router@^3.0.2: - version "3.0.5" - resolved "https://registry.yarnpkg.com/react-router/-/react-router-3.0.5.tgz#c3b7873758045a8bbc9562aef4ff4bc8cce7c136" +react-router-redux@next: + version "5.0.0-alpha.6" + resolved "https://registry.yarnpkg.com/react-router-redux/-/react-router-redux-5.0.0-alpha.6.tgz#7418663c2ecd3c51be856fcf28f3d1deecc1a576" dependencies: - create-react-class "^15.5.1" - history "^3.0.0" + history "^4.5.1" + prop-types "^15.5.4" + react-router "^4.1.1" + +react-router@^4.1.1: + version "4.1.2" + resolved "https://registry.yarnpkg.com/react-router/-/react-router-4.1.2.tgz#7ae027341abc42eb08ad9f7a8cac08d0563672ce" + dependencies: + history "^4.6.0" hoist-non-react-statics "^1.2.0" - invariant "^2.2.1" - loose-envify "^1.2.0" - prop-types "^15.5.6" + invariant "^2.2.2" + loose-envify "^1.3.1" + path-to-regexp "^1.5.3" + prop-types "^15.5.4" warning "^3.0.0" react-scripts@^1.0.7: @@ -5495,6 +5501,10 @@ resolve-from@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-1.0.1.tgz#26cbfe935d1aeeeabb29bc3fe5aeb01e93d44226" +resolve-pathname@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/resolve-pathname/-/resolve-pathname-2.1.0.tgz#e8358801b86b83b17560d4e3c382d7aef2100944" + resolve@1.1.7, resolve@^1.1.6: version "1.1.7" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.1.7.tgz#203114d82ad2c5ed9e8e0411b3932875e889e97b" @@ -6330,6 +6340,10 @@ validate-npm-package-license@^3.0.1: spdx-correct "~1.0.0" spdx-expression-parse "~1.0.0" +value-equal@^0.2.0: + version "0.2.1" + resolved "https://registry.yarnpkg.com/value-equal/-/value-equal-0.2.1.tgz#c220a304361fce6994dbbedaa3c7e1a1b895871d" + vary@~1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/vary/-/vary-1.1.0.tgz#e1e5affbbd16ae768dd2674394b9ad3022653140" |