diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2021-03-15 19:09:37 +0100 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2021-03-15 19:09:37 +0100 |
| commit | 8792e9fe1c7ab76c35f9a18d866880ba3da2c13e (patch) | |
| tree | fbdc78484f654ec344d10814cb83987c873d4360 /frontend/site/store.js | |
| parent | 7c15f34186622410e25ee85c01d832e48e012140 (diff) | |
move frontend site folder. add video support
Diffstat (limited to 'frontend/site/store.js')
| -rw-r--r-- | frontend/site/store.js | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/frontend/site/store.js b/frontend/site/store.js new file mode 100644 index 0000000..6511613 --- /dev/null +++ b/frontend/site/store.js @@ -0,0 +1,37 @@ +import { applyMiddleware, compose, combineReducers, createStore } from 'redux' +import { connectRouter, routerMiddleware } from 'connected-react-router' +import { createBrowserHistory } from 'history' +import thunk from 'redux-thunk' + +import siteReducer from 'site/site/site.reducer' + +const createRootReducer = history => ( + combineReducers({ + auth: (state = {}) => state, + router: connectRouter(history), + site: siteReducer, + }) +) + +const configureStore = (initialState = {}, history) => { + const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose + + const store = createStore( + createRootReducer(history), + initialState, + composeEnhancers( + applyMiddleware( + thunk, + routerMiddleware(history) + ), + ), + ) + + return store +} + +const history = createBrowserHistory() +const store = configureStore({}, history) +const { dispatch } = store + +export { store, history, dispatch } |
