Skip to content

Commit ba0d3fd

Browse files
authored
Update utils.js
1 parent a906e59 commit ba0d3fd

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

utils.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -268,8 +268,10 @@ let axios = {
268268

269269
const xmlhttp = new XMLHttpRequest();
270270

271-
xmlhttp.onload = () => {
272-
resolve(JSON.parse(xmlhttp.responseText));
271+
xmlhttp.onreadystatechange = () => {
272+
if (xmlhttp.readyState == 4 && (xmlhttp.status == 201 || xmlhttp.status == 200)) {
273+
resolve(JSON.parse(xmlhttp.responseText));
274+
}
273275
};
274276

275277
xmlhttp.onerror = (e) => {
@@ -295,8 +297,10 @@ let axios = {
295297

296298
const xmlhttp = new XMLHttpRequest();
297299

298-
xmlhttp.onload = () => {
299-
resolve(xmlhttp.responseText);
300+
xmlhttp.onreadystatechange = () => {
301+
if (xmlhttp.readyState == 4 && (xmlhttp.status == 201 || xmlhttp.status == 200)) {
302+
resolve(JSON.parse(xmlhttp.responseText));
303+
}
300304
};
301305

302306
xmlhttp.onerror = (e) => {

0 commit comments

Comments
 (0)