From 594ac1fa00640c206add916fa552bb172d3fa995 Mon Sep 17 00:00:00 2001 From: Marcel Gansfusz Date: Tue, 4 Nov 2025 16:55:11 +0100 Subject: [PATCH] updated censoring status logic --- app/static/app.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/app/static/app.js b/app/static/app.js index 41bd5f5..97d886d 100644 --- a/app/static/app.js +++ b/app/static/app.js @@ -284,9 +284,8 @@ function submitPdf(eve) { } async function submitForm(formData) { try { - const updateEventSource = new EventSource( - window.location + "get_censor_status/" + doc.fID, - ); + const 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); updateEventSource.addEventListener("censorUpdate", function(eve) { @@ -295,6 +294,12 @@ async function submitForm(formData) { upload_status.innerText = "Censoring Page " + data.page + "/" + data.pages; }); + } catch { + console.error( + "Error geting eventsource for updating censoring page count: " + error, + ); + } + try { const response = await fetch("/submit/", { method: "POST", body: formData, @@ -320,7 +325,7 @@ async function submitForm(formData) { window.alert("Error: " + (await response.json())["detail"]); } } catch (error) { - console.error("Error" + error); + console.error("Error submitting: " + error); } } function uploadPdf(eve) {