|
@@ -1,5 +1,6 @@
|
|
|
import { PRE_GAME, PRE_ROUND, IN_ROUND, POST_ROUND, POST_GAME } from "./GameState";
|
|
|
import { createStore } from "../store";
|
|
|
+import { createGame } from "./GGSHService";
|
|
|
|
|
|
export const [
|
|
|
{
|
|
@@ -27,4 +28,9 @@ export const [
|
|
|
startRound: ([set]) => set({ gameState: IN_ROUND }),
|
|
|
endRound: ([set], lastRound) => set({ lastRound, gameState: POST_ROUND }),
|
|
|
endGame: ([set]) => set({ gameState: POST_GAME }),
|
|
|
+ createGameAndStart: async ([set, get], timer) => {
|
|
|
+ const name = get.playerName();
|
|
|
+ const gameId = await createGame(name, timer);
|
|
|
+ set({ gameId, gameJoined: true, gameState: PRE_ROUND });
|
|
|
+ },
|
|
|
});
|