Ensure that response always has json_ok even if no internet.
This commit is contained in:
parent
2f68b800c5
commit
0694073b70
1 changed files with 7 additions and 3 deletions
|
@ -85,14 +85,19 @@ function _request(method, url, callback)
|
||||||
*/
|
*/
|
||||||
const request = new XMLHttpRequest();
|
const request = new XMLHttpRequest();
|
||||||
const response = {
|
const response = {
|
||||||
"meta": {"completed": false, "status": 0},
|
"meta": {
|
||||||
|
"completed": false,
|
||||||
|
"status": 0,
|
||||||
|
"json_ok": false,
|
||||||
|
"request_url": url,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
request.onreadystatechange = function()
|
request.onreadystatechange = function()
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
readystate values:
|
readystate values:
|
||||||
0 UNSENT
|
0 UNSENT / ABORTED
|
||||||
1 OPENED
|
1 OPENED
|
||||||
2 HEADERS_RECEIVED
|
2 HEADERS_RECEIVED
|
||||||
3 LOADING
|
3 LOADING
|
||||||
|
@ -105,7 +110,6 @@ function _request(method, url, callback)
|
||||||
{return;}
|
{return;}
|
||||||
|
|
||||||
response.meta.status = request.status;
|
response.meta.status = request.status;
|
||||||
response.meta.request_url = url;
|
|
||||||
|
|
||||||
if (request.status != 0)
|
if (request.status != 0)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue