laravel-request 1.1.10 → 1.1.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/Api.js +11 -3
package/package.json
CHANGED
package/src/Api.js
CHANGED
|
@@ -203,11 +203,15 @@ export default class Api {
|
|
|
203
203
|
const statusCode = response.status;
|
|
204
204
|
|
|
205
205
|
// get full response object
|
|
206
|
-
const xhr = response;
|
|
206
|
+
const xhr = response.request;
|
|
207
207
|
|
|
208
208
|
const responseData = response.data;
|
|
209
209
|
|
|
210
|
-
|
|
210
|
+
try {
|
|
211
|
+
success(responseData, statusCode, xhr);
|
|
212
|
+
}catch (error){
|
|
213
|
+
console.error(error);
|
|
214
|
+
}
|
|
211
215
|
|
|
212
216
|
return responseData;
|
|
213
217
|
} catch(e) {
|
|
@@ -229,7 +233,11 @@ export default class Api {
|
|
|
229
233
|
// status text
|
|
230
234
|
const statusText = e.response.statusText;
|
|
231
235
|
|
|
232
|
-
|
|
236
|
+
try {
|
|
237
|
+
error(xhr, statusCode, statusText);
|
|
238
|
+
}catch (error){
|
|
239
|
+
console.error(error);
|
|
240
|
+
}
|
|
233
241
|
}
|
|
234
242
|
}
|
|
235
243
|
}
|