This commit is contained in:
2025-08-09 15:48:14 -04:00
parent 2ff5d781fd
commit 5e8978c550
9 changed files with 90 additions and 40 deletions

View File

@@ -1,5 +1,9 @@
import { Accessor, createContext, createResource, Show } from "solid-js";
import { GameState, Action } from "../../../server/src/games/simple";
import {
GameState,
Action,
vGameState,
} from "../../../server/src/games/simple";
import api from "../api";
import Hand from "./Hand";
import Pile from "./Pile";
@@ -20,7 +24,7 @@ export default (props: { instanceId: string }) => {
api
.simple(props)
.post({ action })
.then((res) => mutate(res.data as GameState));
.then((res) => res.status == 200 && mutate(res.data as vGameState));
return (
<GameContext.Provider value={{ gameState, submitAction }}>
@@ -38,7 +42,7 @@ export default (props: { instanceId: string }) => {
}
/>
</div>
<Hand hand={gameState.latest!.players[0]} />
<Hand hand={gameState.latest!.players["daniel"]} />
</div>
</Show>
</GameContext.Provider>