Final changes.

This commit is contained in:
Harrison Deng 2022-04-05 20:54:26 -05:00
parent 6cd421ba01
commit 34bbfb3d5d
3 changed files with 11 additions and 2 deletions

View File

@ -13,7 +13,7 @@ export default class SportInfoCard extends React.Component {
<Card.Title>{this.props.sport.name}</Card.Title> <Card.Title>{this.props.sport.name}</Card.Title>
<Card.Subtitle className="mb-2 text-muted">{this.props.sport.minPlayers.toString()}</Card.Subtitle> <Card.Subtitle className="mb-2 text-muted">{this.props.sport.minPlayers.toString()}</Card.Subtitle>
<Card.Text> <Card.Text>
<p>{this.props.sport.description}</p> {this.props.sport.description}
</Card.Text> </Card.Text>
</Card.Body> </Card.Body>
</Card> </Card>

View File

@ -4,6 +4,9 @@ import "../styles/Dashboard.css";
import { apiClient } from "../utils/httpClients.js"; import { apiClient } from "../utils/httpClients.js";
import MatchInfoCardDisplay from "../components/MatchInfoCardDisplay"; import MatchInfoCardDisplay from "../components/MatchInfoCardDisplay";
import SportInfoCardDisplay from "../components/SportInfoCardDisplay"; import SportInfoCardDisplay from "../components/SportInfoCardDisplay";
import { globalContext } from "../context";
import { needUser } from "../utils/routing";
export default class Dashboard extends React.Component { export default class Dashboard extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props);
@ -15,7 +18,10 @@ export default class Dashboard extends React.Component {
}; };
} }
static contextType = globalContext;
async componentDidMount() { async componentDidMount() {
await needUser(this.context.navigate);
await this.latestMatches(); await this.latestMatches();
await this.availableSports(); await this.availableSports();
} }

View File

@ -1,7 +1,10 @@
import axios from "axios"; import axios from "axios";
export const apiClient = axios.create({ export const apiClient = axios.create({
baseURL: process.env.REACT_APP_API_HOST + "/api/", baseURL: process.env.REACT_APP_API_HOST || "" + "/api/",
timeout: 5000, timeout: 5000,
withCredentials: process.env.NODE_ENV === "development", withCredentials: process.env.NODE_ENV === "development",
validateStatus: function (status) {
return status === 401 || status == 200;
}
}); });