Created
March 3, 2018 22:49
-
-
Save AndrewRayCode/79805c0ebde695289fa44da2c73e2427 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class A extends Component { | |
componentDidMount() { | |
const { baseUrl } = config; | |
const data = []; | |
Promise.all(getEndpoints(baseUrl).then(endpoints => { | |
return Promise.all(endpoints.map(endpoint => { | |
return getEndpointData(endpoint, baseUrl).then(response => { | |
return {endpoint, response}; | |
}); | |
})); | |
})).then(data => { | |
this.setState({ data }); | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment