diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2020-07-11 00:50:00 +0200 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2020-07-11 00:50:00 +0200 |
| commit | 91e8fdb99e321496c54288fe5a3db6397c768c10 (patch) | |
| tree | 2bb82323466c7895eb705138e561278b02ce8ca2 /frontend/site/store.js | |
| parent | 2001ddd7e2a8926ec97fdd4d5c73b2d4e5b293de (diff) | |
building basic site. need to include cursors, etc
Diffstat (limited to 'frontend/site/store.js')
| -rw-r--r-- | frontend/site/store.js | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/frontend/site/store.js b/frontend/site/store.js new file mode 100644 index 0000000..cd77990 --- /dev/null +++ b/frontend/site/store.js @@ -0,0 +1,38 @@ +import { applyMiddleware, compose, combineReducers, createStore } from 'redux' +import { connectRouter, routerMiddleware } from 'connected-react-router' +import { createBrowserHistory } from 'history' +import thunk from 'redux-thunk' +// import { login } from './util' + +import siteReducer from './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 } |
