File tree Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change 61
61
"react-dom" : " ^15.5.4" ,
62
62
"react-redux" : " ^5.0.4" ,
63
63
"redux" : " ^3.6.0" ,
64
+ "redux-fetch-middleware" : " ^3.0.2" ,
64
65
"redux-thunk" : " ^2.2.0" ,
65
66
"rimraf" : " ~2.6.1" ,
66
67
"semver" : " ~5.3.0" ,
Original file line number Diff line number Diff line change 1
1
import { createStore , applyMiddleware } from 'redux' ;
2
2
import thunk from 'redux-thunk' ;
3
+ import fetchMiddlewareCreator from 'redux-fetch-middleware' ;
3
4
import ungitApp from './reducers' ;
4
5
6
+ const fetchMiddleware = fetchMiddlewareCreator ( {
7
+ suffix : [ 'REQUEST' , 'SUCCESS' , 'FAILURE' ] ,
8
+ debug : process . env . NODE_ENV === 'development' ,
9
+ fetchOptions : {
10
+ headers : {
11
+ 'Accept' : 'application/json' ,
12
+ 'Content-Type' : 'application/json'
13
+ }
14
+ }
15
+ } ) ;
16
+
17
+ const middlewares = [ thunk , fetchMiddleware ] ;
18
+
5
19
const initialState = {
6
20
config : {
7
21
ungitConfig : null ,
@@ -23,6 +37,6 @@ const initialState = {
23
37
}
24
38
} ;
25
39
26
- const store = createStore ( ungitApp , initialState , applyMiddleware ( thunk ) ) ;
40
+ const store = createStore ( ungitApp , initialState , applyMiddleware ( ... middlewares ) ) ;
27
41
28
42
export default store ;
You can’t perform that action at this time.
0 commit comments