import React from 'react'; import { getStatus, createGame, gameInfo } from "./services/ggsh.service"; import './App.css'; class InfoComponent extends React.Component { constructor(props) { super(props); this.state = { loading: true, version: null, status: null, } } async componentDidMount() { const { version, status } = await getStatus(); this.setState({loading: false, version, status}); } render() { if (this.state.loading) { return
Connecting to back-end...
} if (this.state.status !== "healthy") { returnUnable to communicate with API server! Error: {this.state.status}
} returnAPI Version: {this.state.version}
} } const GameInfo = ({game}) => { const { gameId, creator, timer, coords, players } = game; return (Game ID: {gameId}
Creator: {creator}
Time Limit: {timer}
Coordinates: {JSON.stringify(coords)}
Players: {JSON.stringify(players)}
Loading...
TerrAssumptions!