import React from "react"; import { Button, InputGroup, FormControl } from "react-bootstrap"; import "../styles/Dashboard.css"; import { apiClient } from "../utils/httpClients.js"; import MatchInfoCardDisplay from "../components/MatchInfoCardDisplay"; import SportInfoCardDisplay from "../components/SportInfoCardDisplay"; import { globalContext } from "../context"; import AuthenticationGuard from "../components/AuthenticationGuard"; export default class Dashboard extends React.Component { constructor(props) { super(props); this.state = { displayedMatches: [], displayedSports: [], displayedEquipment: [], user: null }; } static contextType = globalContext; async componentDidMount() { this.setState({ user: this.context.user }); await this.latestMatches(); await this.availableSports(); } async latestMatches() { let recentMatchesRes = await apiClient.get("/match/recent/15"); if (recentMatchesRes.status === 200) { this.setState({ displayedMatches: recentMatchesRes.data.recent }); } } async availableSports() { let availableSportsRes = await apiClient.get("/sport"); if (availableSportsRes.status === 200) { this.setState({ displayedSports: availableSportsRes.data }); } } render() { return (

Available Matches

Available Sports

); } }