File tree Expand file tree Collapse file tree 4 files changed +15
-7
lines changed Expand file tree Collapse file tree 4 files changed +15
-7
lines changed Original file line number Diff line number Diff line change 71
71
"react-redux" : " ^6.0.1" ,
72
72
"react-router-dom" : " ^5.0.0" ,
73
73
"redux" : " ^4.0.1" ,
74
- "urijs" : " ^1.19.1 "
74
+ "urijs" : " ^1.19.4 "
75
75
},
76
76
"devDependencies" : {
77
77
"@babel/core" : " 7.4.3" ,
Original file line number Diff line number Diff line change @@ -175,6 +175,8 @@ export class API {
175
175
176
176
const headers = {
177
177
'content-type' : 'application/json' ,
178
+
179
+
178
180
} ;
179
181
180
182
if ( this . token && this . token . token ) {
@@ -186,20 +188,27 @@ export class API {
186
188
url : this . route ( opts ) ,
187
189
params : query ,
188
190
headers,
189
- transformResponse : [ ] ,
191
+ transformResponse : [ function transformResponse ( data , headers ) {
192
+ if ( typeof data === 'string' && headers [ "content-type" ] === "application/json" ) {
193
+ try {
194
+ data = JSON . parse ( data ) ;
195
+ } catch ( e ) { /* Ignore */ }
196
+ }
197
+ return data ;
198
+ }
199
+ ] ,
190
200
data,
191
201
withCredentials : true ,
192
202
paramsSerializer : params => {
193
203
params = _ . mapValues ( params , param => {
194
204
if ( _ . isArray ( param ) ) {
195
205
return param . join ( ',' ) ;
196
206
}
197
-
198
207
return param ;
199
208
} ) ;
200
-
201
209
return buildURL ( '' , params ) . substr ( 1 ) ;
202
210
} ,
211
+ // responseType: 'json',
203
212
} ;
204
213
205
214
if ( this . rejectUnauthorized === false ) {
@@ -210,7 +219,6 @@ export class API {
210
219
}
211
220
212
221
const response = await axios ( config ) ;
213
-
214
222
const contentType = ( response . headers || { } ) [ 'content-type' ] || [ ] ;
215
223
const requestId = ( response . headers || { } ) [ 'X-Request-ID' ] || null ;
216
224
Original file line number Diff line number Diff line change 30
30
"lodash" : " 4.17.19" ,
31
31
"react" : " 16.8.6" ,
32
32
"react-dom" : " 16.8.6" ,
33
- "axios" : " ^0.18.0 " ,
33
+ "axios" : " ^0.21.1 " ,
34
34
"moxios" : " ^0.4.0"
35
35
},
36
36
"devDependencies" : {
Original file line number Diff line number Diff line change 85
85
"react-redux" : " 7.0.2" ,
86
86
"redux" : " ^4.0.1" ,
87
87
"set-value" : " ^2.0.1" ,
88
- "urijs" : " 1.19.4" ,
88
+ "urijs" : " ^ 1.19.4" ,
89
89
"websocket-extensions" : " ^0.1.4"
90
90
},
91
91
"devDependencies" : {
You can’t perform that action at this time.
0 commit comments