mirror of
https://github.com/Karaka-Management/jsOMS.git
synced 2026-02-12 07:38:41 +00:00
Fix response handling
This commit is contained in:
parent
86dfb12b07
commit
f6e2f23ece
|
|
@ -214,13 +214,12 @@
|
||||||
request.setSuccess(function (xhr)
|
request.setSuccess(function (xhr)
|
||||||
{
|
{
|
||||||
console.log(xhr.response);
|
console.log(xhr.response);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const o = JSON.parse(xhr.response),
|
const o = JSON.parse(xhr.response),
|
||||||
response = new jsOMS.Message.Response.Response(o),
|
response = new jsOMS.Message.Response.Response(o);
|
||||||
responseLength = response.count();
|
|
||||||
let tempResponse = null,
|
let tempResponse = null,
|
||||||
success = null;
|
successInject = null;
|
||||||
|
|
||||||
if (typeof o.status !== 'undefined') {
|
if (typeof o.status !== 'undefined') {
|
||||||
self.app.notifyManager.send(
|
self.app.notifyManager.send(
|
||||||
|
|
@ -228,15 +227,10 @@
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Handle responses (can be multiple response object) */
|
if ((successInject = form.getSuccess()) !== null) {
|
||||||
for (let k = 0; k < responseLength; ++k) {
|
successInject(tempResponse);
|
||||||
tempResponse = response.getByIndex(k);
|
} else {
|
||||||
|
self.app.responseManager.run(tempResponse.type, tempResponse, request);
|
||||||
if ((success = form.getSuccess()) !== null) {
|
|
||||||
success(tempResponse);
|
|
||||||
} else {
|
|
||||||
self.app.responseManager.run(tempResponse.type, tempResponse, request);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log(e);
|
console.log(e);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user