diff options
author | Victor Chabbert <chabbertvi@eisti.eu> | 2016-12-23 21:45:00 +0100 |
---|---|---|
committer | Victor Chabbert <chabbertvi@eisti.eu> | 2016-12-23 21:45:00 +0100 |
commit | 3a59b53777e626ad5a6fd482b90bfb0d839051b4 (patch) | |
tree | 7a21ac1bc2dcfb564141a1817a1549f736bfac9a /src/main/js | |
parent | Change router from v4 to v3 (diff) | |
download | seven-wonders-3a59b53777e626ad5a6fd482b90bfb0d839051b4.tar.gz seven-wonders-3a59b53777e626ad5a6fd482b90bfb0d839051b4.tar.bz2 seven-wonders-3a59b53777e626ad5a6fd482b90bfb0d839051b4.zip |
Add react-router-redux
Diffstat (limited to 'src/main/js')
-rw-r--r-- | src/main/js/package.json | 1 | ||||
-rw-r--r-- | src/main/js/src/index.js | 6 | ||||
-rw-r--r-- | src/main/js/src/reducers.js | 3 | ||||
-rw-r--r-- | src/main/js/src/store.js | 7 | ||||
-rw-r--r-- | src/main/js/yarn.lock | 4 |
5 files changed, 16 insertions, 5 deletions
diff --git a/src/main/js/package.json b/src/main/js/package.json index 63191cf0..34632161 100644 --- a/src/main/js/package.json +++ b/src/main/js/package.json @@ -12,6 +12,7 @@ "react-dom": "^15.4.1", "react-redux": "^5.0.1", "react-router": "^3.0.0", + "react-router-redux": "^4.0.7", "rebass": "^0.3.3", "redux": "^3.6.0", "redux-saga": "^0.13.0", diff --git a/src/main/js/src/index.js b/src/main/js/src/index.js index d2ffe1c6..78c63ddf 100644 --- a/src/main/js/src/index.js +++ b/src/main/js/src/index.js @@ -2,12 +2,12 @@ import 'babel-polyfill' import React from 'react' import ReactDOM from 'react-dom' -import { Router, browserHistory, Route } from 'react-router' +import { Router, Route } from 'react-router' import { Provider } from 'react-redux' import configureStore from './store' const initialState = {} -const store = configureStore(initialState) +const { store, history } = configureStore(initialState) import './global-styles.css' import App from './containers/App' @@ -15,7 +15,7 @@ import Error404 from './components/errors/Error404' ReactDOM.render( <Provider store={store}> - <Router history={browserHistory}> + <Router history={history}> <div className="app"> <Route path="/" component={App}/> <Route path="*" component={Error404}/> diff --git a/src/main/js/src/reducers.js b/src/main/js/src/reducers.js index 5a369ce5..42887838 100644 --- a/src/main/js/src/reducers.js +++ b/src/main/js/src/reducers.js @@ -1,9 +1,10 @@ import { combineReducers } from 'redux' - +import { routerReducer } from 'react-router-redux' import gamesReducer from './containers/GameBrowser/reducer' export default function createReducer() { return combineReducers({ games: gamesReducer, + routing: routerReducer }) } diff --git a/src/main/js/src/store.js b/src/main/js/src/store.js index 31c8aa71..8368b508 100644 --- a/src/main/js/src/store.js +++ b/src/main/js/src/store.js @@ -1,4 +1,6 @@ import { createStore, applyMiddleware, compose } from 'redux' +import { browserHistory} from 'react-router' +import { syncHistoryWithStore } from 'react-router-redux' import createReducer from './reducers' import createSagaMiddleware from 'redux-saga' @@ -29,5 +31,8 @@ export default function configureStore(initialState = {}) { sagaMiddleware.run(rootSaga) - return store + return { + store, + history: syncHistoryWithStore(browserHistory, store) + } } diff --git a/src/main/js/yarn.lock b/src/main/js/yarn.lock index 5d7c02d2..cee03120 100644 --- a/src/main/js/yarn.lock +++ b/src/main/js/yarn.lock @@ -4223,6 +4223,10 @@ react-redux: lodash-es "^4.2.0" loose-envify "^1.1.0" +react-router-redux@^4.0.7: + version "4.0.7" + resolved "https://registry.yarnpkg.com/react-router-redux/-/react-router-redux-4.0.7.tgz#9b1fde4e70106c50f47214e12bdd888cfb96e2a6" + react-router@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/react-router/-/react-router-3.0.0.tgz#3f313e4dbaf57048c48dd0a8c3cac24d93667dff" |