fix billing process

This commit is contained in:
Dennis Eichhorn 2023-04-08 04:36:26 +02:00
parent bc95c66f57
commit 0dd94695b8
4 changed files with 22 additions and 7 deletions

View File

@ -34,7 +34,7 @@ export class Response
*/ */
get (id = null) get (id = null)
{ {
return id === null ? this.responses : this.responses[id]; return id === null ? this.responses : (typeof this.responses[id] === 'undefined' ? null : this.responses[id]);
}; };
/** /**

View File

@ -1076,7 +1076,7 @@ export class Form
.catch((error) => { .catch((error) => {
console.warn(error); console.warn(error);
}); });
} else if (typeof response.get('type') !== 'undefined') { } else if (response.get('type') !== null) {
self.app.responseManager.run(response.get('type'), response.get(), null); self.app.responseManager.run(response.get('type'), response.get(), null);
} else if (typeof o.status !== 'undefined' && o.status !== NotificationLevel.HIDDEN) { } else if (typeof o.status !== 'undefined' && o.status !== NotificationLevel.HIDDEN) {
self.app.notifyManager.send( self.app.notifyManager.send(
@ -1098,10 +1098,11 @@ export class Form
request.setResultCallback(0, function (xhr) request.setResultCallback(0, function (xhr)
{ {
try { try {
const o = JSON.parse(xhr.response)[0]; const o = JSON.parse(xhr.response)[0];
const response = new Response(o); const response = new Response(o);
if (typeof response.get('type') !== 'undefined') { if (response.get('type') !== null) {
console.log(response.get('type'));
} else if (typeof o.status !== 'undefined' && o.status !== NotificationLevel.HIDDEN) { } else if (typeof o.status !== 'undefined' && o.status !== NotificationLevel.HIDDEN) {
self.app.notifyManager.send( self.app.notifyManager.send(
new NotificationMessage(o.status, o.title, o.message), NotificationType.APP_NOTIFICATION new NotificationMessage(o.status, o.title, o.message), NotificationType.APP_NOTIFICATION

View File

@ -105,15 +105,21 @@ export class GeneralUI
uri = uri === null ? this.getAttribute('href') : uri; uri = uri === null ? this.getAttribute('href') : uri;
if (this.getAttribute('target') === '_blank' if (this.getAttribute('target') === '_blank'
|| this.getAttribute(['data-target']) === '_blank' || this.getAttribute('data-target') === '_blank'
|| event.button === 1 || event.button === 1
|| uri.startsWith('https://') || uri.startsWith('https://')
) { ) {
window.open(UriFactory.build(uri), '_blank'); window.open(UriFactory.build(uri), '_blank');
} else if (this.getAttribute('data-redirect') !== null) {
uri = window.omsApp.request.getRootPath() + uri;
window.location.assign(uri);
} else { } else {
// window.location = UriFactory.build(uri); // window.location = UriFactory.build(uri);
// @todo : consider to implement the line above again. why was it removed?
uri = window.omsApp.request.getRootPath() + uri;
fetch(UriFactory.build(uri)) fetch(UriFactory.build(uri))
.then((response) => response.text()) .then (response => response.text())
.then((html) => { .then((html) => {
if (window.omsApp.state && window.omsApp.state.hasChanges) { if (window.omsApp.state && window.omsApp.state.hasChanges) {
const message = new NotificationMessage( const message = new NotificationMessage(
@ -167,6 +173,9 @@ export class GeneralUI
*/ */
// @todo: fix memory leak which most likely exists because of continous binding without removing binds // @todo: fix memory leak which most likely exists because of continous binding without removing binds
window.omsApp.reInit(); window.omsApp.reInit();
const event = new Event('DOMContentLoaded');
window.dispatchEvent(event);
} }
}) })
.catch((error) => { .catch((error) => {

View File

@ -215,6 +215,11 @@ export class HttpUri
this.set(this.uri); this.set(this.uri);
}; };
getRootPath ()
{
return this.root;
}
/** /**
* Get Uri base * Get Uri base
* *