Another fix for refresh.
This commit is contained in:
@@ -152,9 +152,18 @@ function submitRefine(event) {
|
||||
modal.show();
|
||||
|
||||
refinePollInterval = setInterval(() => {
|
||||
fetch(`/task_status/${data.task_id}`).then(r => r.json()).then(status => {
|
||||
if (status.status === 'completed') window.location.reload();
|
||||
});
|
||||
fetch(`/task_status/${data.task_id}`)
|
||||
.then(r => r.json())
|
||||
.then(status => {
|
||||
if (status.status === 'completed') {
|
||||
clearInterval(refinePollInterval);
|
||||
if (status.success === false) {
|
||||
alert("Refinement failed: " + (status.error || "Check logs"));
|
||||
}
|
||||
window.location.reload();
|
||||
}
|
||||
})
|
||||
.catch(e => console.error(e));
|
||||
}, 2000);
|
||||
}
|
||||
})
|
||||
|
||||
@@ -646,17 +646,26 @@
|
||||
showRefiningModal();
|
||||
|
||||
const pollInterval = setInterval(() => {
|
||||
fetch(`/task_status/${data.task_id}`).then(r => r.json()).then(status => {
|
||||
if (status.status === 'completed') {
|
||||
clearInterval(pollInterval);
|
||||
if (status.success) {
|
||||
window.location.href = "/project/{{ project.id }}/bible_comparison";
|
||||
} else {
|
||||
alert("Refinement failed. Please check the logs.");
|
||||
window.location.reload();
|
||||
fetch(`/task_status/${data.task_id}`)
|
||||
.then(r => {
|
||||
if (!r.ok) throw new Error("Server error checking status");
|
||||
return r.json();
|
||||
})
|
||||
.then(status => {
|
||||
if (status.status === 'completed') {
|
||||
clearInterval(pollInterval);
|
||||
if (status.success) {
|
||||
window.location.href = "/project/{{ project.id }}/bible_comparison";
|
||||
} else {
|
||||
alert("Refinement failed: " + (status.error || "Check logs for details."));
|
||||
window.location.reload();
|
||||
}
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
console.error("Polling error:", err);
|
||||
}
|
||||
});
|
||||
);
|
||||
}, 2000);
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user