Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found

Submitted

Advice generator app solution

Andrey Esmanβ€’ 70

@Andy-Esm

Desktop design screenshot for the Advice generator app coding challenge

This is a solution for...

  • HTML
  • CSS
  • JS
  • API
2junior
View challenge

Design comparison


SolutionDesign

Solution retrospective


Can't figure out why I get the same data by clicking the button???

Community feedback

@MelvinAguilar

Posted

Hi @Andy-Esm πŸ‘‹, good job on completing this challenge! πŸŽ‰

This API mentions the following in its documentation: Note: Advice is cached for 2 seconds. Any repeat-request within 2 seconds will return the same piece of advice. You can add the header cache: 'no-cache' to your fetch, but this will allow the button to be spammed. During the first two seconds after pressing the button, the button should be disabled or something should indicate that it is loading

Good job, and happy coding!

Marked as helpful

2

Andrey Esmanβ€’ 70

@Andy-Esm

Posted

@MelvinAguilar Didn't know that. Thank you!

1
Md5 daltonβ€’ 1,430

@md5dalton

Posted

Hello Andrey Esman πŸ‘‹

Well done with your solution for this challenge πŸ‘

Excellent advice from @MelvinAguilar and if you were wondering how to add that no-cache option, here's how you can do it:

fetch ("https://api.adviceslip.com/advice", {cache: "no-cache"})...

Cheers πŸ‘Œ

Marked as helpful

1

Andrey Esmanβ€’ 70

@Andy-Esm

Posted

@md5dalton Thank You!

1

Please log in to post a comment

Log in with GitHub
Discord logo

Join 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