diff --git a/pages/list.js b/pages/list.js index 8dfe530..8e03fa4 100644 --- a/pages/list.js +++ b/pages/list.js @@ -1,10 +1,72 @@ import Head from 'next/head'; +import '../static/everypage.css'; +import { Footer, TurniereNavigation } from '../js/CommonComponents'; +import React from 'react'; +import { Card, CardBody, Container } from 'reactstrap'; +import { getRequest, getState } from '../js/api'; export default () => ( -
+
- Turnie.re - Turnierliste + Öffentliche Turniere: turnie.re -

Turnierliste

+ +
+ +
+
); + +class TournamentList extends React.Component { + constructor(props) { + super(props); + this.state = { + error: null, + isLoaded: false, + items: [] + }; + } + + componentDidMount() { + getRequest(getState(), '/tournaments?type=public') + .then( + response => { + this.setState({ + isLoaded: true, + items: response.data + }); + }, + error => { + this.setState({ + isLoaded: true, + error + }); + } + ); + } + + render() { + return ( + + + +

Öffentliche Turniere

+ {this.state.items.map(item => ( + //The code should be item.code but the api just supports it this way by now + + ))} +
+
+
+ ); + } +} + +function TournamentListEntry(props) { + return ( + + {props.name} + + ); +}