-
-
Save andruxnet/e20c6f4a436bce5095dcad89257576fd 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
function getQuote() { | |
return fetch('https://andruxnet-random-famous-quotes.p.mashape.com/?cat=famous', { | |
method: POST, | |
headers: { | |
"X-Mashape-Key": "b6tCZGODOTmshRX3SGwKX39eANfup1NqESSjsnPp9aB0mxbvHF", | |
"Content-Type": "application/x-www-form-urlencoded", | |
"Accept": "application/json" | |
} | |
}) | |
.then(blob => { | |
console.log(blob); | |
return blob.json | |
}) | |
.then((response) => { | |
console.log(response); // so that I can see the response - looks like response.body is where the quote would be | |
return handleResponse(response) | |
}) | |
.catch((error) => { | |
return handleError(error); | |
}) | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment