Ignore:
Timestamp:
07/18/22 13:59:55 (2 years ago)
Author:
anastasovv <simon@…>
Branches:
main
Children:
22367db
Parents:
e903234
Message:

Ability for admin to watch live games and for user to see games history

File:
1 edited

Legend:

Unmodified
Added
Removed
  • components/Stats.jsx

    re903234 rfaff334  
    55
    66import { AiOutlineClose } from 'react-icons/ai';
     7
     8import axios from 'axios';
    79
    810const Stats = () => {
     
    1820    }
    1921
     22    function openHistory() {
     23        axios.get(`/api/postgre?action=get_games_history&session_id=${localStorage.CAESSINO_SESSION_ID}`).then(res => {
     24            if (res.data?.success) {
     25                dispatch(setStyle({
     26                    ...styleState.style,
     27                    gamesHistory: {
     28                        blackjack: {
     29                            rooms: res.data?.blackjack,
     30                        },
     31                        roulette: {
     32                            games: res.data?.roulette,
     33                        },
     34                        poker: {
     35                            tables: res.data?.poker,
     36                        },
     37                    },
     38                    displayGamesHistoryScreen: true,
     39                }))
     40            }
     41        })
     42    }
     43
    2044    return (
    2145        <div className="fullscreen fs-centered statsScreen" style={{display: styleState.style.displayStatsScreen ? 'block' : 'none'}}>
     
    2751                <p>Total roulette games won: <span>{styleState.style.statsScreenInfo.roulette.wins}</span></p>
    2852                <p>Total poker games won: <span>{styleState.style.statsScreenInfo.poker.wins}</span></p>
     53
     54                <button onClick={() => openHistory()} className="primaryButton" style={{marginTop: '5rem', marginLeft: '1rem'}}>See Games History</button>
    2955            </div>
    3056        </div>
Note: See TracChangeset for help on using the changeset viewer.