Tell us what’s happening:
Hey guys, i have passed all the other tests except for 1 that states " 9. My quote machine should fetch the new quote’s author when the #new-quote button is clicked and display it in the #author element.". It works fine when i run my application and i have checked all my ids as well.
For this challenge i am using React and for the quotes i have been using an external API. The error that i got while running the test cases is “Timeout of 1500ms exceeded”.
Any help would be appreciated.
My application can be found here: https://codesandbox.io/s/4zyxn3qyl9
Your code so far
the following code is my fetchData function. This is my first time using API so could there be a mistake in how i am implementing it?
//making external API call to forismtic for quote and authot. Make sure to have proxy appended to prevent no //cors error
fetchData() {
fetch(
“https://cors-anywhere.herokuapp.com/https://api.forismatic.com/api/1.0/?method=getQuote&format=json&lang=en”
)
.then(Response => Response.json())
.then(data =>
this.setState({
quote: data.quoteText,
author: data.quoteAuthor
})
)
.catch(error => console.log(error));
this.changeColor();
}
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36
.
Link to the challenge: