diff options
Diffstat (limited to 'animism-align/frontend/store.js')
| -rw-r--r-- | animism-align/frontend/store.js | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/animism-align/frontend/store.js b/animism-align/frontend/store.js new file mode 100644 index 0000000..b4aff91 --- /dev/null +++ b/animism-align/frontend/store.js @@ -0,0 +1,44 @@ +import { applyMiddleware, compose, combineReducers, createStore } from 'redux' +import { connectRouter, routerMiddleware } from 'connected-react-router' +import { createBrowserHistory } from 'history' +// import createDebounce from 'redux-debounced' +// import thunk from 'redux-thunk' +// import { login } from './util' + +import uploadReducer from './views/upload/upload.reducer' +import siteReducer from './views/site/site.reducer' +// import collectionReducer from './views/collection/collection.reducer' + +const createRootReducer = history => ( + combineReducers({ + auth: (state = {}) => state, + router: connectRouter(history), + site: siteReducer, + upload: uploadReducer, + // collection: collectionReducer, + }) +) + +const configureStore = (initialState = {}, history) => { + const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose + + const store = createStore( + createRootReducer(history), + initialState, + composeEnhancers( + applyMiddleware( + // thunk, + // createDebounce(), + routerMiddleware(history) + ), + ), + ) + + return store +} + +const history = createBrowserHistory() +const store = configureStore({}, history) +const { dispatch } = store + +export { store, history, dispatch } |
