fix(multi): sync game mode changes to server in lobby

This commit is contained in:
jessy-david-dev
2026-04-12 23:59:40 +02:00
parent 064ddda23a
commit 169f71c67d
4 changed files with 29 additions and 2 deletions
+14 -1
View File
@@ -127,7 +127,7 @@ export async function PATCH(
article?: string;
startArticle?: string;
targetArticle?: string;
value?: boolean;
value?: boolean | number | string;
};
// Nettoyer les joueurs inactifs uniquement hors partie (lobby/résultats)
@@ -351,6 +351,19 @@ export async function PATCH(
return Response.json({ room });
}
// Hôte change le mode de jeu
case "setGameMode": {
const host = room.players.find((p) => p.id === playerId);
if (!host?.isHost) {
return Response.json({ error: "Seul l'hôte peut modifier ce paramètre" }, { status: 403 });
}
if (value === "race" || value === "all_finish") {
room.gameMode = value;
await saveRoom(room);
}
return Response.json({ room });
}
// Hôte change la limite de temps
case "setTimeLimit": {
const host = room.players.find((p) => p.id === playerId);