Add attribute "completed" to response object.

This commit is contained in:
voussoir 2020-06-28 16:47:54 -07:00
parent 27219d74c4
commit fcbb128f47

View file

@ -6,18 +6,25 @@ common._request =
function _request(method, url, callback) function _request(method, url, callback)
{ {
var request = new XMLHttpRequest(); var request = new XMLHttpRequest();
var response = {
"completed": false,
};
request.onreadystatechange = function() request.onreadystatechange = function()
{ {
if (request.readyState == 4) if (request.readyState == 4)
{ {
if (callback != null) if (callback != null)
{ {
var response = { if (request.status != 0)
"meta": {}, {
"data": JSON.parse(request.responseText) response["completed"] = true;
}; response["data"] = JSON.parse(request.responseText);
response["meta"]["request_url"] = url; }
response["meta"]["status"] = request.status; response["meta"] = {
"request_url": url,
"status": request.status
}
callback(response); callback(response);
} }
} }