From 7f380324d4c531c629b505952dd93948c4c69e08 Mon Sep 17 00:00:00 2001 From: haunter Date: Wed, 6 May 2026 23:47:22 +0300 Subject: [PATCH] fix --- templates/agora.html | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/templates/agora.html b/templates/agora.html index b115267..a79fc4c 100644 --- a/templates/agora.html +++ b/templates/agora.html @@ -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 {