source: redux/reducers/playerSlice.js@ 189cd8f

main
Last change on this file since 189cd8f was b13f93b, checked in by anastasovv <simon@…>, 2 years ago

Made poker tables system and round 1

  • Property mode set to 100644
File size: 1.8 KB
Line 
1import { createSlice } from '@reduxjs/toolkit';
2
3const initialState = {
4 player: {
5 displayName: '',
6 username: '',
7 session_id: '',
8 room_id: '',
9 credits: 0,
10 },
11 blackjackGame: {
12 status: '',
13 playerCards: [],
14 dealerCards: [],
15 sideBetName: '',
16 },
17 rouletteGame: {
18 status: '',
19 timeToStart: 0,
20 players: [],
21 },
22 pokerGame: {
23 tables: [],
24 table: {
25 id: '',
26 name: '',
27 status: '',
28 creator: '',
29 started: false,
30 round: 0,
31 turnIdx: 0,
32 lastBet: 0,
33 turnsSinceLastBet: 0,
34 players: [{
35 id: '',
36 table: '',
37 status: '',
38 displayName: '',
39 cards: [],
40 betAmount: 0,
41 isSatDown: false,
42 iSCoordinator: false,
43 }],
44 cards: [],
45 },
46 player: {
47 status: '',
48 cards: [],
49 table: '',
50 isSatDown: false,
51 isCoordinator: false,
52 },
53 },
54}
55
56export const playerSlice = createSlice({
57 name: 'player',
58 initialState,
59 reducers: {
60 setPlayer: (state, action) => {
61 state.player = action.payload;
62 },
63 setBlackjackGame: (state, action) => {
64 state.blackjackGame = action.payload;
65 },
66 setRouletteGame: (state, action) => {
67 state.rouletteGame = action.payload;
68 },
69 setPokerGame: (state, action) => {
70 state.pokerGame = action.payload;
71 },
72 }
73})
74
75export const { setPlayer, setBlackjackGame, setRouletteGame, setPokerGame } = playerSlice.actions
76
77export default playerSlice.reducer
Note: See TracBrowser for help on using the repository browser.