fix healer

master
Denis Ranneft 1 month ago
parent dd1d09e87d
commit 0a72101c8a

@ -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' });

@ -549,10 +549,10 @@ export async function buyPotion(telegramId?: number): Promise<HeroResponse> {
return apiPost<HeroResponse>(`/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<HeroResponse> {
/** 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<HeroResponse> {
const query = telegramId != null ? `?telegramId=${telegramId}` : '';
return apiPost<HeroResponse>(`/hero/npc-heal${query}`);
return apiPost<HeroResponse>(`/hero/npc-heal${query}`, { npcId: npcId ?? 0 });
}
// ---- NPC Proximity & Interaction ----

@ -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(

Loading…
Cancel
Save