feat(combat): rejoin the running combat instead of dead-ending

Attacking while a combat is already active returned COMBAT_ALREADY_ACTIVE
and left the hunt page showing an error the player could not act on, with
no way back into the fight they were already in.

Add GET /api/combats/active so the client can resolve that combat, and
have the hunt page navigate into it when an attack is rejected for this
reason. CombatStore now also exposes the error code so callers can tell
this case apart from a genuinely failed attack.
This commit is contained in:
Bastian Wagner
2026-08-19 22:45:53 +02:00
parent 92b9f1cd35
commit f33b0c0e4a
10 changed files with 244 additions and 7 deletions

View File

@@ -48,6 +48,16 @@ export class HuntPageComponent implements OnInit {
const combat = this.combatStore.combat();
if (combat) {
void this.router.navigate(['/combat', combat.id]);
return;
}
// A fight already running is not a dead end: rejoin it rather than
// leaving the player stuck behind an error they cannot act on.
if (this.combatStore.errorCode() === 'COMBAT_ALREADY_ACTIVE') {
const active = await this.combatStore.loadActiveCombat();
if (active) {
void this.router.navigate(['/combat', active.id]);
}
}
}