@CallMe-AL
Posted
Looks good Nyrell, congrats on finishing your first project utilizing an API!! Looks very good too. Some minor suggestions:
-
I'd wrap your code inside the fetchAdvice() function in a try/catch block to catch errors. You could also add an if statement to see if your response returns 200-209 (ex: if (response.ok){ ...some code }). You might find this video useful for some extra tips: https://www.youtube.com/watch?v=_9vgd9XKlDQ
-
UI-wise the dice remains rotated after I click on it, unless I click off. You might also want to add some styling to let users know there's the 2 second wait between advice (like a countdown timer and a way to prevent clicking the button, or something).
Great job again, keep it up!
@nyrellcl
Posted
Hi @CallMe-AL ! Thank you so much! I plan to do even more projects with APIs now lol
-
I will definitely work on implementing both of those suggestions, which sounds like will make the code operate better. I will also watch the link you provided!
-
Ah yes, that’s what i forgot to mention and ask a question about. I’m glad you pointed it out as I was stuck on that. The timer idea sounds like a good idea to try out!!
Thank you for taking the time to suggest!!
@CallMe-AL
Posted
@nyrellcl Absolutely, I'm glad the advice was helpful! Good luck with the changes and hope you enjoy the video! Happy coding, looking forward to hopefully seeing more from you on the site!