feat: gameboard ui

This commit is contained in:
2025-12-29 11:15:02 +00:00
parent c68cda350e
commit cfda949ea6
59 changed files with 2564 additions and 18 deletions
+19
View File
@@ -0,0 +1,19 @@
import axios from "axios";
import { getUser } from "../state/connection.js";
import { createGame, joinGame, playCard, getGame } from "../state/game.js";
const API_URL = process.env.API_URL || "http://localhost:8000/api";
export const handleGameEvents = (io, socket) => {
socket.on("create-game", async (data) => {
try {
const user = getUser(socket.id);
const game = createGame(data.type, user);
socket.join(`game_${game.match_id}`);
} catch (error) {
console.error("Error creating game:", error);
socket.emit("error", { message: "Failed to create game." });
}
});
};