
Design comparison
Solution retrospective
This is my first project using API, I'm quite happy and proud to have managed to do it!
What specific areas of your project would you like help with?I don't know if this solution I gave for my API is the best using async function()
and await
. If you have any suggestions on how to improve my code, I appreciate it!
Community feedback
- @DennyDoesFrontendPosted 23 days ago
Your API doesnt get called when you click the dice. This is because the API (https://api.adviceslip.com/advice) sometimes caches responses, meaning clicking the button might fetch the same advice repeatedly. You can easily fix this by using
const url = `https://api.adviceslip.com/advice?timestamp=${new Date().getTime()}`;
using a timestamp will force the API URL to run again with a fresh response. I hope this helps :)
Marked as helpful2P@xuaunPosted 23 days agoHey Denzel,
Wow, it's working normally here, but it's good to know that there is a way to ensure that the API is called using the
timestamp
. Thanks for the help!I've already updated here, I hope it works now haha.
1@DennyDoesFrontendPosted 23 days ago@xuaun Glad I could help. Its working on my side now too.
1
Please log in to post a comment
Log in with GitHubJoin our Discord community
Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!
Join our Discord