I've been doing the random quote machine project for freecodecamp and I can't seem to stop the response from the api being cached.
I've tried various answers:
I thought I had it at one point:
fetch(this.url, {cache: 'no-cache'})
.then(res => res.json())
... but I was just disabling the cache in developer tools.
Please help. :-D.
Here is where i've been trying to make it work: https://codepen.io/JonathanDWood/pen/gRNNKx
I have managed to fix it by appending Date.now()
to the url. I don't really like it as a permanent solution as it doesn't address the underlying caching issue but it works.
fetch(this.url+ Date.now(), {cache: 'no-store'})
.then(res => res.json())