fix(n8n Form Node): Show Form Complition after Form Complition page (#14226)

This commit is contained in:
Michael Kret
2025-03-28 17:13:35 +02:00
committed by GitHub
parent 970fab7e30
commit af777307b3

View File

@@ -157,6 +157,33 @@
<a id='redirectUrl' href='{{redirectUrl}}' style='display: none;'></a>
{{/if}}
<script>
let interval = 1000;
let timeoutId;
const checkExecutionStatus = async () => {
if (!interval) return;
try {
const response = await fetch(`${ window.location.href }/n8n-execution-status`);
const text = (await response.text()).trim();
if (text === "form-waiting") {
window.location.replace(window.location.href);
return;
}
if(["canceled", "crashed", "error", "success", "null" ].includes(text)) {
interval = 0;
clearTimeout(timeoutId);
return;
}
interval = Math.round(interval * 1.1);
timeoutId = setTimeout(checkExecutionStatus, interval);
} catch (error) {
console.error("Error fetching data:", error);
}
};
document.addEventListener('DOMContentLoaded', function () {
const binary = "{{{responseBinary}}}"
? JSON.parse(decodeURIComponent("{{{responseBinary}}}"))
@@ -210,6 +237,9 @@
})
.catch(function (error) {
console.error('Error:', error);
})
.finally(() => {
timeoutId = setTimeout(checkExecutionStatus, interval);
});
</script>
</body>