Fixes that may break things

This commit is contained in:
Dennis Eichhorn 2018-03-24 19:12:02 +01:00
parent 7fa4daa8d5
commit 86dfb12b07
2 changed files with 13 additions and 17 deletions

View File

@ -337,17 +337,17 @@
{ {
const self = this; const self = this;
if (self.xhr.readyState !== 1) { if (this.xhr.readyState !== 1) {
self.xhr.open(this.method, jsOMS.Uri.UriFactory.build(this.uri)); this.xhr.open(this.method, jsOMS.Uri.UriFactory.build(this.uri));
for (let p in this.requestHeader) { for (let p in this.requestHeader) {
if (this.requestHeader.hasOwnProperty(p)) { if (this.requestHeader.hasOwnProperty(p)) {
self.xhr.setRequestHeader(p, this.requestHeader[p]); this.xhr.setRequestHeader(p, this.requestHeader[p]);
} }
} }
} }
self.xhr.onreadystatechange = function () this.xhr.onreadystatechange = function ()
{ {
switch (self.xhr.readyState) { switch (self.xhr.readyState) {
case 4: case 4:
@ -370,12 +370,12 @@
if (this.type === jsOMS.Message.Request.RequestType.JSON) { if (this.type === jsOMS.Message.Request.RequestType.JSON) {
if (typeof this.requestHeader !== 'undefined' && this.requestHeader['Content-Type'] === 'application/json') { if (typeof this.requestHeader !== 'undefined' && this.requestHeader['Content-Type'] === 'application/json') {
self.xhr.send(JSON.stringify(this.data)); this.xhr.send(JSON.stringify(this.data));
} else { } else {
self.xhr.send(this.queryfy(this.data)); this.xhr.send(this.queryfy(this.data));
} }
} else if (this.type === jsOMS.Message.Request.RequestType.RAW) { } else if (this.type === jsOMS.Message.Request.RequestType.RAW) {
self.xhr.send(this.data); this.xhr.send(this.data);
} }
}; };
}(window.jsOMS = window.jsOMS || {})); }(window.jsOMS = window.jsOMS || {}));

View File

@ -164,8 +164,8 @@
for (let property in injects) { for (let property in injects) {
if (injects.hasOwnProperty(property)) { if (injects.hasOwnProperty(property)) {
counter++; counter++;
this.app.eventManager.addGroup(form.getId(), counter); //this.app.eventManager.addGroup(form.getId(), counter);
const result = injects[property](form, counter, form.getId()); const result = injects[property](form, form.getId());
if (result === false) { if (result === false) {
return; return;
@ -175,9 +175,7 @@
} }
} }
if (counter === 0) { this.app.eventManager.trigger(form.getId());
this.app.eventManager.trigger(form.getId());
}
}; };
/** /**
@ -215,6 +213,8 @@
request.setRequestHeader('Content-Type', 'application/json'); request.setRequestHeader('Content-Type', 'application/json');
request.setSuccess(function (xhr) request.setSuccess(function (xhr)
{ {
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),
@ -224,11 +224,7 @@
if (typeof o.status !== 'undefined') { if (typeof o.status !== 'undefined') {
self.app.notifyManager.send( self.app.notifyManager.send(
new jsOMS.Message.Notification.NotificationMessage( new jsOMS.Message.Notification.NotificationMessage(o.status, o.title, o.message), jsOMS.Message.Notification.NotificationType.APP_NOTIFICATION
o.status,
o.title,
o.message
), jsOMS.Message.Notification.NotificationType.APP_NOTIFICATION
); );
} }