fix on fix

This commit is contained in:
2026-05-07 22:59:09 +03:00
parent 74b51e74ca
commit ae0322facb
2 changed files with 20 additions and 1 deletions

View File

@@ -659,7 +659,17 @@
celebration_type: celType
})
});
const d = await r.json();
// Read raw text first — if the server returns an HTML error page,
// JSON.parse would throw a useless SyntaxError. This shows the real problem.
const raw = await r.text();
let d = {};
try { d = JSON.parse(raw); } catch (_) {
closeModal();
showToast(`❌ Server error (${r.status}): ${raw.substring(0, 120)}`, 'err');
return;
}
closeModal();
if (r.ok && d.ok) {
showToast(`✅ Εντολή στάλθηκε — ${TYPE_LABELS[celType]}`, 'ok');
@@ -673,6 +683,7 @@
}
}
// ── Log ──────────────────────────────────────────────────────────
function toggleLog() {
logOpen = !logOpen;