source: redux/reducers/playerSlice.js@ ace7865

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

Finished Roulette

  • Property mode set to 100644
File size: 1.6 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 status: '_1_waiting_for_players',
24 turnIdx: 0,
25 playerCards: ['c4', 'c2'],
26 cardsOnTable: ['c3', 'c1', 'c5'],
27 players: [
28 {
29 status: 'disconnected',
30 displayName: 'Pero',
31 betAmount: 33,
32 },
33 {
34 status: 'playing',
35 displayName: 'Johnny',
36 betAmount: 29,
37 },
38 {
39 status: 'onTurn',
40 displayName: 'Waterlo',
41 betAmount: 199,
42 },
43 ]
44 }
45 // pokerGame: {
46 // status: '',
47 // turnIdx: 0,
48 // players: [],
49 // }
50}
51
52export const playerSlice = createSlice({
53 name: 'player',
54 initialState,
55 reducers: {
56 setPlayer: (state, action) => {
57 state.player = action.payload;
58 },
59 setBlackjackGame: (state, action) => {
60 state.blackjackGame = action.payload;
61 },
62 setRouletteGame: (state, action) => {
63 state.rouletteGame = action.payload;
64 },
65 }
66})
67
68export const { setPlayer, setBlackjackGame, setRouletteGame } = playerSlice.actions
69
70export default playerSlice.reducer
Note: See TracBrowser for help on using the repository browser.