import Head from 'next/head' import React from 'react' import {Container, ListGroup, ListGroupItem} from 'reactstrap'; import 'bootstrap/dist/css/bootstrap.min.css'; import {BigImage, Footer, TurniereNavigation} from '../js/CommonComponents.js' import '../static/everypage.css' import {getRequest} from "../js/api"; function Tournament(props) { return ( Turnier bearbeiten

{props.tournament.description}

{props.tournament.isPublic ? 'Das Turnier ist öffentlich.' : 'Das Turnier ist privat.'} Turnier-Code: {props.tournament.code}
); } function TournamentContainer(props) { if (props.data === null) { return null } else { return } } class Main extends React.Component { constructor(props) { super(props); const code = this.props.query.code; getRequest('/tournaments/' + code, {}) .then(response => { const attributes = response.data.data.attributes; const relationships = response.data.data.relationships; this.setState({ tournament: { name: attributes.name, code: attributes.code, description: attributes.description, isPublic: attributes.public, teams: relationships.teams.data.map(team => team.id), stages: relationships.stages.data.map(stage => stage.id) } }); }) .catch(error => console.log(error)); } static async getInitialProps({query}) { return {query} } render() { const tournamentName = this.state === null ? 'Turnier' : this.state.tournament.name; return (
{tournamentName}: turnie.re {JSON.stringify(this.state)}
); } } export default Main