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: [],
loaded: false
};
}
componentDidMount() {
requestTournamentList(this.props.type, tournaments => {
this.setState({
tournaments: tournaments,
loaded: true
});
}, () => {
this.setState({loaded: true});
});
}
render() {
if (!this.state.loaded) {
return (
lade Turnier-Liste
);
}
if (this.state.tournaments.length === 0) {
return keine Turniere vorhanden;
}
return this.state.tournaments.map(item => (
// The code should be item.code but the api just supports it this way by now
));
}
}
function EmptyList(props) {
return (
{props.children}
);
}
function TournamentListEntry(props) {
return (
{props.name}
);
}