mirror of
https://github.com/Karaka-Management/jsOMS.git
synced 2026-02-15 16:58:42 +00:00
update
This commit is contained in:
parent
a56face85c
commit
07a2ab5a48
|
|
@ -1130,30 +1130,34 @@ export class Form
|
||||||
const response = new Response(o);
|
const response = new Response(o);
|
||||||
let successInject = null;
|
let successInject = null;
|
||||||
|
|
||||||
if ((successInject = form.getSuccess()) !== null) {
|
const statusCode = xhr.getResponseHeader('status');
|
||||||
successInject(response, xhr);
|
|
||||||
} else if (redirect !== null) {
|
|
||||||
fetch(UriFactory.build(redirect))
|
|
||||||
.then((response) => response.text())
|
|
||||||
.then((html) => {
|
|
||||||
document.documentElement.innerHTML = html;
|
|
||||||
|
|
||||||
if (window.omsApp.state) {
|
if (statusCode === 200 || statusCode === null) {
|
||||||
window.omsApp.state.hasChanges = false;
|
if ((successInject = form.getSuccess()) !== null) {
|
||||||
}
|
successInject(response, xhr);
|
||||||
|
} else if (redirect !== null) {
|
||||||
|
fetch(UriFactory.build(redirect))
|
||||||
|
.then((response) => response.text())
|
||||||
|
.then((html) => {
|
||||||
|
document.documentElement.innerHTML = html;
|
||||||
|
|
||||||
history.pushState({}, null, UriFactory.build(redirect));
|
if (window.omsApp.state) {
|
||||||
/* This is not working as it reloads the page ?!
|
window.omsApp.state.hasChanges = false;
|
||||||
document.open();
|
}
|
||||||
document.write(html);
|
|
||||||
document.close();
|
history.pushState({}, null, UriFactory.build(redirect));
|
||||||
*/
|
/* This is not working as it reloads the page ?!
|
||||||
// @todo: fix memory leak which most likely exists because of continous binding without removing binds
|
document.open();
|
||||||
window.omsApp.reInit();
|
document.write(html);
|
||||||
})
|
document.close();
|
||||||
.catch((error) => {
|
*/
|
||||||
console.warn(error);
|
// @todo: fix memory leak which most likely exists because of continous binding without removing binds
|
||||||
});
|
window.omsApp.reInit();
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
console.warn(error);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (response.get('type') !== null) {
|
if (response.get('type') !== null) {
|
||||||
|
|
@ -1165,7 +1169,6 @@ export class Form
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
Logger.instance.log(e);
|
Logger.instance.log(e);
|
||||||
|
|
||||||
Logger.instance.error('Invalid form response. \n'
|
Logger.instance.error('Invalid form response. \n'
|
||||||
+ 'URL: ' + form.getAction() + '\n'
|
+ 'URL: ' + form.getAction() + '\n'
|
||||||
+ 'Request: ' + JSON.stringify(form.getData()) + '\n'
|
+ 'Request: ' + JSON.stringify(form.getData()) + '\n'
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user