Skip to content

Instantly share code, notes, and snippets.

@zlatkov
Created October 11, 2017 14:47
Show Gist options
  • Save zlatkov/30e8c04023639ed289a5d107b6989269 to your computer and use it in GitHub Desktop.
Save zlatkov/30e8c04023639ed289a5d107b6989269 to your computer and use it in GitHub Desktop.
function loadData() {
return getJSON()
.then(function(response) {
if (response.needsAnotherRequest) {
return makeAnotherRequest(response)
.then(function(anotherResponse) {
console.log(anotherResponse)
return anotherResponse
})
} else {
console.log(response)
return response
}
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment