Created
October 11, 2017 14:47
-
-
Save zlatkov/30e8c04023639ed289a5d107b6989269 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
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