feat(game): add configurable rounds per room

This commit is contained in:
jessy-david-dev
2026-04-11 13:47:05 +02:00
parent d245232497
commit e9f39c572d
8 changed files with 175 additions and 114 deletions
+2 -2
View File
@@ -152,11 +152,11 @@ export function useMultiGame() {
// Room actions
async function createRoom(playerName: string): Promise<{ error?: string }> {
async function createRoom(playerName: string, maxPlayers = 16, totalRounds = 3): Promise<{ error?: string }> {
const res = await fetch("/api/rooms", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ playerName }),
body: JSON.stringify({ playerName, maxPlayers, totalRounds }),
});
const data = await res.json() as { room?: Room; playerId?: string; error?: string };
if (!res.ok) return { error: data.error ?? "Erreur" };