Skip to content

Instantly share code, notes, and snippets.

@AndrewRayCode
Created March 3, 2018 22:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AndrewRayCode/79805c0ebde695289fa44da2c73e2427 to your computer and use it in GitHub Desktop.
Save AndrewRayCode/79805c0ebde695289fa44da2c73e2427 to your computer and use it in GitHub Desktop.
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