Is there a way to display a message when a request is taking too long? For instance, if the request exceeds 10 seconds in duration, I want to show a message asking the user to wait until it finishes.
fetchData(url, requestParams) {
return this.restService.get('url', requestParams)
}
displayMessage(duration) {
setTimeout( () => {
console.log("The request is taking more than 10 seconds. Please be patient.")
}, duration)
}
I attempted using setTimeout but did not achieve the desired outcome.