1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
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 alignReducer from './views/align/align.reducer'
import audioReducer from './views/audio/audio.reducer'
import paragraphReducer from './views/paragraph/paragraph.reducer'
import annotationReducer from './views/annotation/annotation.reducer'
import siteReducer from './views/site/site.reducer'
import mediaReducer from './views/media/media.reducer'
// import collectionReducer from './views/collection/collection.reducer'
const createRootReducer = history => (
combineReducers({
auth: (state = {}) => state,
router: connectRouter(history),
site: siteReducer,
upload: uploadReducer,
align: alignReducer,
audio: audioReducer,
paragraph: paragraphReducer,
annotation: annotationReducer,
media: mediaReducer,
})
)
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 }
|