|
@@ -6,6 +6,7 @@ import ReactDOM from 'react-dom'
|
|
import { createStore, applyMiddleware, combineReducers, bindActionCreators, compose } from 'redux'
|
|
import { createStore, applyMiddleware, combineReducers, bindActionCreators, compose } from 'redux'
|
|
import { Provider, connect } from 'react-redux'
|
|
import { Provider, connect } from 'react-redux'
|
|
import createSagaMiddleware from 'redux-saga'
|
|
import createSagaMiddleware from 'redux-saga'
|
|
|
|
+import { all } from 'redux-saga/effects'
|
|
|
|
|
|
/** react-router is not used in this project.
|
|
/** react-router is not used in this project.
|
|
import { browserHistory, Router, Route, IndexRoute } from 'react-router'
|
|
import { browserHistory, Router, Route, IndexRoute } from 'react-router'
|
|
@@ -40,23 +41,29 @@ const defaultState = {
|
|
}
|
|
}
|
|
console.log('Default state:', defaultState)
|
|
console.log('Default state:', defaultState)
|
|
|
|
|
|
|
|
+/** The root saga, calling all other sagas */
|
|
|
|
+function * rootSaga () {
|
|
|
|
+ console.log('rootSaga called')
|
|
|
|
+ yield all([
|
|
|
|
+ playerList.saga(),
|
|
|
|
+ matchList.saga(),
|
|
|
|
+ layout.saga()
|
|
|
|
+ ])
|
|
|
|
+}
|
|
|
|
+
|
|
/** Create the saga middleware */
|
|
/** Create the saga middleware */
|
|
const sagaMiddleware = createSagaMiddleware()
|
|
const sagaMiddleware = createSagaMiddleware()
|
|
|
|
|
|
/** The enhancer allows to use Redux development tools in Chrome */
|
|
/** The enhancer allows to use Redux development tools in Chrome */
|
|
const enhancers = compose(
|
|
const enhancers = compose(
|
|
- window.devToolsExtension ? window.devToolsExtension() : f => f,
|
|
|
|
- applyMiddleware(sagaMiddleware)
|
|
|
|
|
|
+ applyMiddleware(sagaMiddleware),
|
|
|
|
+ window.devToolsExtension ? window.devToolsExtension() : f => f
|
|
)
|
|
)
|
|
console.log('Enhancers:', enhancers)
|
|
console.log('Enhancers:', enhancers)
|
|
|
|
|
|
/** 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, enhancers)
|
|
const store = createStore(rootReducer, defaultState, enhancers)
|
|
-sagaMiddleware.run(function * () {
|
|
|
|
- yield playerList.saga()
|
|
|
|
- yield matchList.saga()
|
|
|
|
- yield layout.saga()
|
|
|
|
-})
|
|
|
|
|
|
+sagaMiddleware.run(rootSaga)
|
|
console.log('Store:', store)
|
|
console.log('Store:', store)
|
|
/** react-route is not used in this project.
|
|
/** react-route is not used in this project.
|
|
const history = syncHistoryWithStore(browserHistory, store)
|
|
const history = syncHistoryWithStore(browserHistory, store)
|