mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +00:00
fix(n8n Form Node): Show Form Complition after Form Complition page (#14226)
This commit is contained in:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user