From 0a72101c8a834aa81ae4e1f8188626da7ac461e0 Mon Sep 17 00:00:00 2001 From: Denis Ranneft Date: Mon, 30 Mar 2026 23:54:15 +0300 Subject: [PATCH] fix healer --- frontend/src/App.tsx | 4 ++-- frontend/src/network/api.ts | 6 +++--- frontend/src/ui/NPCDialog.tsx | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index 09cc24e..cba665a 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -1044,9 +1044,9 @@ export function App() { }); }, [handleNPCHeroUpdated]); - const handleNPCHeal = useCallback((_npc: NPCData) => { + const handleNPCHeal = useCallback((npc: NPCData) => { const telegramId = getTelegramUserId() ?? 1; - healAtNPC(telegramId) + healAtNPC(telegramId, npc.id) .then((hero) => { hapticImpact('medium'); setToast({ message: tr.healedToFull, color: '#44cc44' }); diff --git a/frontend/src/network/api.ts b/frontend/src/network/api.ts index a068dc6..7d1a520 100644 --- a/frontend/src/network/api.ts +++ b/frontend/src/network/api.ts @@ -549,10 +549,10 @@ export async function buyPotion(telegramId?: number): Promise { return apiPost(`/hero/npc-buy-potion${query}`); } -/** Heal to full at a healer NPC (matches backend POST /api/v1/hero/npc-heal) */ -export async function healAtNPC(telegramId?: number): Promise { +/** Heal to full at a healer NPC (matches backend POST /api/v1/hero/npc-heal; body must be JSON with npcId) */ +export async function healAtNPC(telegramId?: number, npcId?: number): Promise { const query = telegramId != null ? `?telegramId=${telegramId}` : ''; - return apiPost(`/hero/npc-heal${query}`); + return apiPost(`/hero/npc-heal${query}`, { npcId: npcId ?? 0 }); } // ---- NPC Proximity & Interaction ---- diff --git a/frontend/src/ui/NPCDialog.tsx b/frontend/src/ui/NPCDialog.tsx index 504fff3..da477cc 100644 --- a/frontend/src/ui/NPCDialog.tsx +++ b/frontend/src/ui/NPCDialog.tsx @@ -329,7 +329,7 @@ export function NPCDialog({ onToast(tr.notEnoughGold, '#ff4444'); return; } - healAtNPC(telegramId) + healAtNPC(telegramId, npc.id) .then((hero) => { hapticImpact('medium'); onToast(tr.healedToFull, '#44cc44'); @@ -339,7 +339,7 @@ export function NPCDialog({ console.warn('[NPCDialog] Failed to heal:', err); onToast(tr.failedToHeal, '#ff4444'); }); - }, [telegramId, heroGold, onHeroUpdated, onToast]); + }, [telegramId, heroGold, onHeroUpdated, onToast, npc.id]); // Quests relevant to this NPC const npcHeroQuests = heroQuests.filter(