usprawnieni i funkcje oraz zabezpieczenia

This commit is contained in:
Mateusz Gruszczyński
2025-07-22 21:56:37 +02:00
parent dea0309cfd
commit 1ab1b36811
3 changed files with 53 additions and 21 deletions

View File

@@ -33,7 +33,6 @@ document.addEventListener("DOMContentLoaded", function () {
};
});
// zapisz przycięty
document.getElementById("saveCrop").addEventListener("click", function () {
if (!cropper) return;
@@ -49,13 +48,14 @@ document.addEventListener("DOMContentLoaded", function () {
.then((res) => res.json())
.then((data) => {
if (data.success) {
location.reload();
showToast("Zapisano przycięty paragon", "success");
setTimeout(() => location.reload(), 1500);
} else {
alert("Błąd: " + data.error || "Nieznany");
showToast("Błąd: " + (data.error || "Nieznany"), "danger");
}
})
.catch((err) => {
alert("Błąd sieci");
showToast("Błąd sieci", "danger");
console.error(err);
});
}, "image/webp");