fix: 增加任务详情自动刷新

This commit is contained in:
meijiali
2026-07-03 12:35:35 +08:00
parent 0a3477cc44
commit b9291f9011
3 changed files with 49 additions and 3 deletions
+20
View File
@@ -71,6 +71,26 @@ document.addEventListener("DOMContentLoaded", () => {
updateScaleHint();
});
function pollTaskDetailStatus(taskId) {
if (!taskId) return;
const intervalMs = 3000;
const poll = async () => {
try {
const resp = await fetch(`/api/tasks/${taskId}`, { cache: "no-store" });
if (!resp.ok) return;
const task = await resp.json();
if (task.status !== "running") {
window.location.reload();
return;
}
} catch (_error) {
return;
}
window.setTimeout(poll, intervalMs);
};
window.setTimeout(poll, intervalMs);
}
async function downloadExport(url, defaultFilename, event) {
if (event) event.preventDefault();
const resp = await fetch(url);