Skip to content

Commit

Permalink
fix: user id when insert move
Browse files Browse the repository at this point in the history
  • Loading branch information
sownfam committed Dec 30, 2023
1 parent 5c15feb commit 6f310f4
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/hooks/useChessSocket.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,11 @@ const useChessSocket = ({ type, id, userId, gameConfig }: Props) => {
const onInitGame = () => {
console.log("Running init...");
// NOTE: We leave a default user-id = 1, so guest can play without having logged in
const initNewGame = { id: id, userId: userId ?? 1, config: gameConfig }; // TODO: Add preferences (difficulty, timer, ...)
const initNewGame = {
id: id,
userId: !userId ? 1 : userId,
config: gameConfig,
}; // TODO: Add preferences (difficulty, timer, ...)
socket?.emit("start-game", JSON.stringify(initNewGame));
};

Expand Down

0 comments on commit 6f310f4

Please sign in to comment.