forked from jeffbski/redux-logic
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfigureStore.js
More file actions
31 lines (24 loc) · 780 Bytes
/
configureStore.js
File metadata and controls
31 lines (24 loc) · 780 Bytes
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
/* global devToolsExtension:false */
import axios from 'axios';
import { compose, createStore, applyMiddleware } from 'redux';
import { createLogicMiddleware } from 'redux-logic';
import rootReducer from './rootReducer';
import logic from './rootLogic';
const deps = { // injected dependencies for logic
httpClient: axios
};
const logicMiddleware = createLogicMiddleware(logic, deps);
const middleware = applyMiddleware(
logicMiddleware
);
// using compose to allow for applyMiddleware, just add it in
const enhancer = (typeof devToolsExtension !== 'undefined') ?
compose(
middleware,
devToolsExtension()
) :
middleware;
export default function configureStore() {
const store = createStore(rootReducer, enhancer);
return store;
}