{"size": 1170, "ext": "js", "max_stars_repo_path": "pages/contests/details.js", "max_stars_repo_name": "iluxancon/DotsFishing", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "pages/contests/details.js", "max_issues_repo_name": "iluxancon/DotsFishing", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "pages/contests/details.js", "max_forks_repo_name": "iluxancon/DotsFishing", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 23.8775510204, "max_line_length": 97, "alphanum_fraction": 0.5581196581}
import DetailsInfo  from "../../components/DetailsInfo.js"

export default class extends React.Component {
    state = {
      details: null,
    }

    static async getInitialProps({query}) {
        return {id: query.id}
    }

    componentDidMount() {
        fetch("http://dots-practice-2018.xeon.prostoksi.com/contests-json?id=" + this.props.id, {
          'credentials': 'include', 
          //headers: { 'Cookie': "DSID=WzETbgEkzCkXOX1H" }
        })
          .then(data => data.json())
          .then(details => this.setState({ details: details }))
      }
      
       


  render() {
    if (this.state.details === null) {
        return <div>Идет загрузка...</div>
    }

    console.log(this.state)
    const detailsContests = <DetailsInfo
            name={this.state.details.title}
            type={this.state.details.type}
            date_of_start={this.state.details.start_time}
            going={this.state.details.status}
            registered={this.state.details.registration_status}
            mode={this.state.details.participation_mode}
            />
    

    return (
      <>
       {detailsContests}
        
      </>
    );
 }

}
