|
@@ -8,10 +8,10 @@ import { Provider, connect } from 'react-redux'
|
|
import createSagaMiddleware from 'redux-saga'
|
|
import createSagaMiddleware from 'redux-saga'
|
|
import { all } from 'redux-saga/effects'
|
|
import { all } from 'redux-saga/effects'
|
|
|
|
|
|
-/** react-router is not used in this project.
|
|
|
|
-import { browserHistory, Router, Route, IndexRoute } from 'react-router'
|
|
|
|
-import { syncHistoryWithStore, routerReducer } from 'react-router-redux'
|
|
|
|
-*/
|
|
|
|
|
|
+// React router
|
|
|
|
+import { Route, Switch, Link } from 'react-router'
|
|
|
|
+import { createBrowserHistory } from 'history'
|
|
|
|
+import { ConnectedRouter, connectRouter, routerMiddleware } from 'connected-react-router'
|
|
|
|
|
|
// Import the main app
|
|
// Import the main app
|
|
import Main from './Main'
|
|
import Main from './Main'
|
|
@@ -23,6 +23,13 @@ import layout from './layout'
|
|
import scraper from './scraper'
|
|
import scraper from './scraper'
|
|
import alerts from './alerts'
|
|
import alerts from './alerts'
|
|
import users from './users'
|
|
import users from './users'
|
|
|
|
+import player from './classes/player';
|
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+ * Browser History
|
|
|
|
+ */
|
|
|
|
+const history = createBrowserHistory()
|
|
|
|
+console.log('history:', history)
|
|
|
|
|
|
/**
|
|
/**
|
|
* Redux Section
|
|
* Redux Section
|
|
@@ -86,7 +93,8 @@ const middleware = [
|
|
logger,
|
|
logger,
|
|
crashReporter,
|
|
crashReporter,
|
|
alerts.middleware,
|
|
alerts.middleware,
|
|
- sagaMiddleware
|
|
|
|
|
|
+ sagaMiddleware,
|
|
|
|
+ routerMiddleware(history)
|
|
]
|
|
]
|
|
/** The enhancer allows to use Redux development tools in Chrome */
|
|
/** The enhancer allows to use Redux development tools in Chrome */
|
|
// see: https://github.com/zalmoxisus/redux-devtools-extension/issues/220
|
|
// see: https://github.com/zalmoxisus/redux-devtools-extension/issues/220
|
|
@@ -110,13 +118,9 @@ if (window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__) {
|
|
console.log('Enhancers:', enhancer)
|
|
console.log('Enhancers:', enhancer)
|
|
|
|
|
|
/** Build the Redux store from the rootReducer, the defualtState and the enhancers. */
|
|
/** Build the Redux store from the rootReducer, the defualtState and the enhancers. */
|
|
-const store = createStore(rootReducer, defaultState, enhancer)
|
|
|
|
|
|
+const store = createStore(connectRouter(history)(rootReducer), defaultState, enhancer)
|
|
console.log('Store:', store)
|
|
console.log('Store:', store)
|
|
sagaMiddleware.run(rootSaga)
|
|
sagaMiddleware.run(rootSaga)
|
|
-/** react-route is not used in this project.
|
|
|
|
-const history = syncHistoryWithStore(browserHistory, store)
|
|
|
|
-console.log('history:', history)
|
|
|
|
-*/
|
|
|
|
|
|
|
|
/** Collect the action creators from all modules in actionCreators */
|
|
/** Collect the action creators from all modules in actionCreators */
|
|
const actionCreators = {
|
|
const actionCreators = {
|
|
@@ -154,26 +158,15 @@ const App = connect(mapStateToProps, mapDispatchToProps)(Main)
|
|
* React-Router Section
|
|
* React-Router Section
|
|
**/
|
|
**/
|
|
|
|
|
|
-/** Combine the routes from all modules.
|
|
|
|
|
|
+// Combine the routes from all modules.
|
|
const router = (
|
|
const router = (
|
|
<Provider store={store}>
|
|
<Provider store={store}>
|
|
- <Router history={history}>
|
|
|
|
- <Route component={App}>
|
|
|
|
- <Route path='/'>
|
|
|
|
- <IndexRoute component={demo_module.components.DemoModule} />
|
|
|
|
- <Route path='/project/:projectId' component={project.components.Project} />
|
|
|
|
- <Route path='/project' component={project.components.Project} />
|
|
|
|
- <Route path='/registermap/:registermapId' component={registermap.components.Registermap} />
|
|
|
|
- <Route path='/registermap' component={registermap.components.Registermap} />
|
|
|
|
- <Route path='/sample' component={Sample} />
|
|
|
|
- </Route>
|
|
|
|
- {demo_module.routes}
|
|
|
|
- <Route path='/login' />
|
|
|
|
- </Route>
|
|
|
|
- </Router>
|
|
|
|
|
|
+ <ConnectedRouter history={history}>
|
|
|
|
+ <App />
|
|
|
|
+ </ConnectedRouter>
|
|
</Provider>
|
|
</Provider>
|
|
)
|
|
)
|
|
-*/
|
|
|
|
|
|
+
|
|
const provider = (
|
|
const provider = (
|
|
<Provider store={store}>
|
|
<Provider store={store}>
|
|
<App />
|
|
<App />
|
|
@@ -184,6 +177,19 @@ const provider = (
|
|
* Render the app
|
|
* Render the app
|
|
**/
|
|
**/
|
|
ReactDOM.render(
|
|
ReactDOM.render(
|
|
- provider,
|
|
|
|
|
|
+ router,
|
|
document.getElementById('root')
|
|
document.getElementById('root')
|
|
)
|
|
)
|
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+ * Hot module reloading
|
|
|
|
+if (module.hot) {
|
|
|
|
+ module.hot.accept('./App', () => {
|
|
|
|
+ render()
|
|
|
|
+ })
|
|
|
|
+
|
|
|
|
+ module.hot.accept('./reducers', () => {
|
|
|
|
+ store.replaceReducer(connectedRouter(history)(rootReducer))
|
|
|
|
+ })
|
|
|
|
+}
|
|
|
|
+ */
|