1234567891011121314151617181920212223242526272829303132333435363738394041 |
- import React from "react";
- import Results from "../components/Results";
- import githubHelpers from "../utils/githubHelpers";
- const PropTypes = React.PropTypes;
- class ResultsContainer extends React.Component {
- constructor(props, context, updater) {
- super(props, context, updater);
- this.state = {
- isLoading: true,
- scores: []
- };
- }
- componentDidMount() {
- githubHelpers.battle(this.props.location.state.playerInfo)
- .then((scores) => {
- this.setState({
- isLoading: false,
- scores
- });
- }).catch((err) => {
- console.warn("Error in battle", err);
- });
- }
- render() {
- return (
- <Results
- isLoading={this.state.isLoading}
- playerInfo={this.props.location.state.playerInfo}
- scores={this.state.scores} />
- );
- }
- }
- ResultsContainer.propTypes = {
-
- };
- export default ResultsContainer;
|