diff --git a/js/components/TournamentList.js b/js/components/TournamentList.js index 4a28da9..6886f17 100644 --- a/js/components/TournamentList.js +++ b/js/components/TournamentList.js @@ -1,35 +1,51 @@ import React from 'react'; import {requestTournamentList} from '../api'; +import {Spinner} from 'react-bootstrap'; export default class TournamentList extends React.Component { constructor(props) { super(props); this.state = { - tournaments: [] + tournaments: [], + loaded: false }; } componentDidMount() { requestTournamentList(this.props.type, tournaments => { this.setState({ - tournaments: tournaments + tournaments: tournaments, + loaded: true }); - }, () => {}); + }, () => { + this.setState({loaded: true}); + }); } render() { - if (this.state.tournaments.length === 0) { - return
keine - Turniere vorhanden
; - } else { - return this.state.tournaments.map(item => ( - // The code should be item.code but the api just supports it this way by now -+ {props.children} +
); +} + function TournamentListEntry(props) { return (