Skip to content

Instantly share code, notes, and snippets.

@AndrewRayCode
Created March 3, 2018 23:02
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/f44c7318c1934324d55373c43465b276 to your computer and use it in GitHub Desktop.
Save AndrewRayCode/f44c7318c1934324d55373c43465b276 to your computer and use it in GitHub Desktop.
const { baseUrl } = config;
getEndpoints(baseUrl).then(endpoints => {
const data = new Array(endpoints.length);
// Update the array as endpoints come in
endpoints.map((endpoint, index) => {
getEndpointData(endpoint, baseUrl).then(response => {
data[index] = {endpoint, response};
this.setState({ data });
});
});
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment