source: redux/reducers/playerSlice.js@ 95ce58b

main
Last change on this file since 95ce58b 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
RevLine 
[87614a5]1import { createSlice } from '@reduxjs/toolkit';
2
3const initialState = {
4 player: {
5 displayName: '',
6 username: '',
7 session_id: '',
8 room_id: '',
9 credits: 0,
10 },
[9bd09b0]11 blackjackGame: {
12 status: '',
[87614a5]13 playerCards: [],
14 dealerCards: [],
15 sideBetName: '',
[9bd09b0]16 },
17 rouletteGame: {
18 status: '',
19 timeToStart: 0,
20 players: [],
[ace7865]21 },
22 pokerGame: {
[b13f93b]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 },
[87614a5]54}
55
56export const playerSlice = createSlice({
57 name: 'player',
58 initialState,
59 reducers: {
60 setPlayer: (state, action) => {
61 state.player = action.payload;
62 },
[9bd09b0]63 setBlackjackGame: (state, action) => {
64 state.blackjackGame = action.payload;
65 },
66 setRouletteGame: (state, action) => {
67 state.rouletteGame = action.payload;
[87614a5]68 },
[b13f93b]69 setPokerGame: (state, action) => {
70 state.pokerGame = action.payload;
71 },
[87614a5]72 }
73})
74
[b13f93b]75export const { setPlayer, setBlackjackGame, setRouletteGame, setPokerGame } = playerSlice.actions
[87614a5]76
77export default playerSlice.reducer
Note: See TracBrowser for help on using the repository browser.