mirror of
https://github.com/Karaka-Management/jsOMS.git
synced 2026-02-12 07:38:41 +00:00
fix form response handling
This commit is contained in:
parent
8f0878e016
commit
bc95c66f57
|
|
@ -1052,8 +1052,6 @@ export class Form
|
||||||
const response = new Response(o);
|
const response = new Response(o);
|
||||||
let successInject = null;
|
let successInject = null;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if ((successInject = form.getSuccess()) !== null) {
|
if ((successInject = form.getSuccess()) !== null) {
|
||||||
successInject(response);
|
successInject(response);
|
||||||
} else if (redirect !== null) {
|
} else if (redirect !== null) {
|
||||||
|
|
@ -1099,13 +1097,25 @@ export class Form
|
||||||
|
|
||||||
request.setResultCallback(0, function (xhr)
|
request.setResultCallback(0, function (xhr)
|
||||||
{
|
{
|
||||||
self.app.notifyManager.send(
|
try {
|
||||||
new NotificationMessage(
|
const o = JSON.parse(xhr.response)[0];
|
||||||
NotificationLevel.ERROR,
|
const response = new Response(o);
|
||||||
'Failure',
|
|
||||||
'Some failure happened'
|
if (typeof response.get('type') !== 'undefined') {
|
||||||
), NotificationType.APP_NOTIFICATION
|
} else if (typeof o.status !== 'undefined' && o.status !== NotificationLevel.HIDDEN) {
|
||||||
);
|
self.app.notifyManager.send(
|
||||||
|
new NotificationMessage(o.status, o.title, o.message), NotificationType.APP_NOTIFICATION
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
self.app.notifyManager.send(
|
||||||
|
new NotificationMessage(
|
||||||
|
NotificationLevel.ERROR,
|
||||||
|
'Failure',
|
||||||
|
'Some failure happened'
|
||||||
|
), NotificationType.APP_NOTIFICATION
|
||||||
|
);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (window.omsApp.state) {
|
if (window.omsApp.state) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user