forked from WebMemex/webmemex-extension
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstore.js
36 lines (30 loc) · 843 Bytes
/
store.js
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
import { createStore, applyMiddleware, compose } from 'redux'
import { combineReducers } from 'redux'
import { createEpicMiddleware } from 'redux-observable';
import { combineEpics } from 'redux-observable';
import thunk from 'redux-thunk'
import overview from 'src/overview'
const rootReducer = combineReducers({
overview: overview.reducer,
})
const rootEpic = combineEpics(
...Object.values(overview.epics),
)
export default function configureStore({ReduxDevTools=undefined}={}) {
const enhancers = [
applyMiddleware(
createEpicMiddleware(rootEpic),
thunk,
),
]
if (ReduxDevTools) {
enhancers.push(ReduxDevTools.instrument())
}
const enhancer = compose(...enhancers)
const store = createStore(
rootReducer,
undefined, // initial state
enhancer
)
return store
}