save finished games to db

This commit is contained in:
Nathaniel Tampus
2023-04-02 00:00:09 +08:00
parent 5088e25769
commit 75eb21c337
2 changed files with 37 additions and 27 deletions

View File

@@ -58,11 +58,13 @@ export function initSocket(
({
reason,
winnerName,
winnerSide
winnerSide,
id
}: {
reason: Game["endReason"];
winnerName?: string;
winnerSide?: "white" | "black" | "draw";
id: number;
}) => {
const m = {
author: { name: "server" }
@@ -89,7 +91,7 @@ export function initSocket(
}
actions.updateLobby({
type: "updateLobby",
payload: { endReason: reason, winner: winnerSide || "draw" }
payload: { endReason: reason, winner: winnerSide || "draw", id }
});
actions.addMessage(m);
}