I decided to use fetch to make the API call, but whenever I ran it in Firefox, the call got cached and would return the same result over and over again. It works as expected in Chrome. Does anyone know what would cause this in Firefox? Also if anyone has tips on centering the button on the container div, I would really appreciate it.
PatrickLee22
@PatrickLee22All comments
- @CMac450Submitted over 1 year ago@PatrickLee22Posted over 1 year ago
Hello there 👋. Congrats on completing the challenge!
To resolve the caching issue, you can set the cache option in your fetch call to 'no-cache' to prevent the browser from caching the response, like so:
fetch('https://api.adviceslip.com/advice', {cache: "no-cache"})
Alternatively, the Advice Slip API has an option to get a specific advice slip if you provide an id number at the end of the URL. You could append a random number to the URL and it which would bypass the caching on the server side.
Marked as helpful1 - @AlekberliSSubmitted over 1 year ago@PatrickLee22Posted over 1 year ago
Hello there 👋. Congrats on completing the challenge!
I've noticed a small glitch with application. It seems you've set the
max-width
of the body to1440px
. As a result, thecontainer
and its child elements are not centred if the browser width is larger than 1440px. If I can make a suggestion, setting the max-width to100vw
or100%
should resolve this issue.Marked as helpful0 - @vishwa3Submitted over 1 year ago
Helloe frontenders - please check out my solution - have added some rad animations
@PatrickLee22Posted over 1 year agoHello there 👋. Congrats on completing the challenge!
I've noticed a small glitch with application. When viewing your app on Firefox, the browser caches the response from the first API call. This would result in subsequent fetch calls to not retrieve a new advice slip.
To resolve this, you can set the cache option in your fetch call to 'no-cache' to prevent the browser from caching the response.
Alternatively, the Advice Slip API has an option to get a specific advice slip if you provide an id number at the end of the URL. You could append a random number to the URL and it which would bypass the caching on the server side.
Marked as helpful1