This commit is contained in:
2026-05-06 23:47:22 +03:00
parent b824144a6a
commit 7f380324d4

View File

@@ -565,6 +565,8 @@
if (!pendingCmd) return;
document.getElementById('btn-confirm').disabled = true;
// Capture before closeModal() nulls pendingCmd
const { townId, townName, celType } = pendingCmd;
try {
const r = await fetch('/dashboard/culture-command', {
method: 'POST',
@@ -572,15 +574,15 @@
body: JSON.stringify({
player_id: PLAYER_ID,
world_id: WORLD_ID,
town_id: pendingCmd.townId,
town_name: pendingCmd.townName,
celebration_type: pendingCmd.celType
town_id: townId,
town_name: townName,
celebration_type: celType
})
});
const d = await r.json();
closeModal();
if (r.ok && d.ok) {
showToast(`✅ Εντολή στάλθηκε — ${TYPE_LABELS[pendingCmd.celType]}`, 'ok');
showToast(`✅ Εντολή στάλθηκε — ${TYPE_LABELS[celType]}`, 'ok');
fetchLog();
setTimeout(fetchAgora, 3000);
} else {