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

All comments

  • Raymond 70

    @IpieA

    Posted

    Hey Ornella, great work. I just worked on this too.

    So, the API documentation says "Advice is cached for 2 seconds. Any repeat-request within 2 seconds will return the same piece of advice." That's probably why quick clicks won't update immediately, but after 2 seconds

    To get past this, you can generate a random query parameter and append to the API URL to bypass the caching mechanism. This is what I mean:

    const timestamp = Date.now(); const res = await fetch(https://api.adviceslip.com/advice?timestamp=${timestamp});

    It tricks the API server to think that it is a new request each time. I hope this helps

    0