From 2f71b7ffc58fb6dc37c88595ea785f352be41919 Mon Sep 17 00:00:00 2001 From: martin Date: Sun, 24 Sep 2023 15:48:46 +0200 Subject: [PATCH] Updated type to match backend --- pac-man-board-game/ClientApp/src/utils/actions.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/pac-man-board-game/ClientApp/src/utils/actions.ts b/pac-man-board-game/ClientApp/src/utils/actions.ts index b5e4d57..7e2f610 100644 --- a/pac-man-board-game/ClientApp/src/utils/actions.ts +++ b/pac-man-board-game/ClientApp/src/utils/actions.ts @@ -105,17 +105,15 @@ function joinGame(data?: PlayerProps[]): void { // TODO missing data when refres store.set(playersAtom, playerProps.map(p => new Player(p))); } -type ReadyData = { allReady: boolean, players: PlayerProps[] } | string; +type ReadyData = { allReady: boolean, players: PlayerProps[] }; function ready(data?: ReadyData): void { - if (data && typeof data !== "string") { + if (data) { const players = data.players.map(p => new Player(p)); store.set(playersAtom, players); if (data.allReady) { store.set(currentPlayerNameAtom, data.players[0].username); } - } else { - console.error("Error:", data); } }