diff options
author | Joffrey BION <joffrey.bion@gmail.com> | 2019-05-16 23:48:38 +0200 |
---|---|---|
committer | Joffrey BION <joffrey.bion@gmail.com> | 2019-05-16 23:48:38 +0200 |
commit | 2382a452456e4bdef4584e1046925e372624cb79 (patch) | |
tree | 0e49b2e5d81facb55fb8b08228abeb218a27d466 /sw-ui/src/store.ts | |
parent | Remove GRADLE_METADATA feature to avoid breaking frontend build (diff) | |
download | seven-wonders-2382a452456e4bdef4584e1046925e372624cb79.tar.gz seven-wonders-2382a452456e4bdef4584e1046925e372624cb79.tar.bz2 seven-wonders-2382a452456e4bdef4584e1046925e372624cb79.zip |
Rationalize module names
Diffstat (limited to 'sw-ui/src/store.ts')
-rw-r--r-- | sw-ui/src/store.ts | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/sw-ui/src/store.ts b/sw-ui/src/store.ts new file mode 100644 index 00000000..54a65509 --- /dev/null +++ b/sw-ui/src/store.ts @@ -0,0 +1,27 @@ +import createHistory from 'history/createBrowserHistory'; +import { routerMiddleware } from 'react-router-redux'; +import { applyMiddleware, createStore } from 'redux'; +import { composeWithDevTools } from 'redux-devtools-extension'; +import createSagaMiddleware from 'redux-saga'; +import { GlobalState } from './reducers'; +import { createReducer } from './reducers'; +import { rootSaga } from './sagas'; + +export function configureStore(initialState: GlobalState) { + const sagaMiddleware = createSagaMiddleware(); + + const history = createHistory(); + + const middlewares = [sagaMiddleware, routerMiddleware(history)]; + + const enhancers = [applyMiddleware(...middlewares)]; + + const store = createStore(createReducer(), initialState, composeWithDevTools(...enhancers)); + + sagaMiddleware.run(rootSaga); + + return { + store, + history, + }; +} |