Changeset 433e0c5 for components/poker/PokerHeader.jsx
- Timestamp:
- 07/15/22 14:45:30 (2 years ago)
- Branches:
- main
- Children:
- 55701f0
- Parents:
- 1df3fde
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
components/poker/PokerHeader.jsx
r1df3fde r433e0c5 10 10 import { useDispatch, useSelector } from 'react-redux' 11 11 12 import { setPlayer, setPokerGame , setSocket} from '../../redux/reducers/playerSlice'12 import { setPlayer, setPokerGame } from '../../redux/reducers/playerSlice' 13 13 import { setStyle } from '../../redux/reducers/styleSlice' 14 14 … … 36 36 if (interval !== null) clearInterval(interval); 37 37 38 dispatch(setPlayer({39 ...playerState.player,40 displayName: res.data?.displayName,41 session_id: res.data?.session_id,42 credits: res.data?.credits,43 }));44 45 dispatch(setStyle({46 ...styleState.style,47 displayLoadingScreen: false,48 }))49 50 38 interval = setInterval(() => { 51 39 axios.get(`/api/poker?action=update_state&session_id=${localStorage.CAESSINO_SESSION_ID}`).then(newRes => { … … 56 44 dispatch(setPlayer({ 57 45 ...playerState.player, 46 displayName: res.data?.displayName, 47 session_id: res.data?.session_id, 58 48 credits: newRes.data?.pokerGame?.player?.credits, 59 49 })) 60 50 } 61 51 } 52 53 dispatch(setStyle({ 54 ...styleState.style, 55 displayLoadingScreen: false, 56 notification: { 57 ...styleState.style.notification, 58 show: false, 59 }, 60 lostConnectionInfo: { 61 show: false, 62 message: '' 63 } 64 })) 65 }).catch(error => { 66 dispatch(setStyle({ 67 ...styleState.style, 68 displayLoadingScreen: false, 69 lostConnectionInfo: { 70 show: true, 71 message: 'Game will be played until the end upon server gets live. You cannot continue your game, but the money earned / lost will be updated.' 72 } 73 })) 62 74 }); 63 }, 2000);75 }, 1000); 64 76 } 65 77 else {
Note:
See TracChangeset
for help on using the changeset viewer.