From 8e74848397dfa9ac10b2caad29f9d2d41cfda6ac Mon Sep 17 00:00:00 2001 From: Marcel Gansfusz Date: Tue, 4 Nov 2025 17:13:18 +0100 Subject: [PATCH] fixed js --- app/static/app.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/static/app.js b/app/static/app.js index 97d886d..dfa8537 100644 --- a/app/static/app.js +++ b/app/static/app.js @@ -283,8 +283,9 @@ function submitPdf(eve) { submitForm(formdata); } async function submitForm(formData) { + var updateEventSource = None; try { - const updateEventSource = new EventSource("/get_censor_status/" + doc.fID); + updateEventSource = new EventSource("/get_censor_status/" + doc.fID); modal.style.display = "flex"; // console.log("http://127.0.0.1:8000/get_censor_status/" + doc.fID); @@ -304,7 +305,9 @@ async function submitForm(formData) { method: "POST", body: formData, }); - updateEventSource.close(); + if (updateEventSource !== None) { + updateEventSource.close(); + } modal.style.display = "none"; //let responseJSON=await response.json(); if (response.ok) {