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)
{
var request = new XMLHttpRequest();
var response = {
"completed": false,
};
request.onreadystatechange = function()
{
if (request.readyState == 4)
{
if (callback != null)
{
var response = {
"meta": {},
"data": JSON.parse(request.responseText)
};
response["meta"]["request_url"] = url;
response["meta"]["status"] = request.status;
if (request.status != 0)
{
response["completed"] = true;
response["data"] = JSON.parse(request.responseText);
}
response["meta"] = {
"request_url": url,
"status": request.status
}
callback(response);
}
}