[Vuejs]-How to disable caching on get call?

0👍

To avoid caching you can make your url unique by appending timestamp as a querystring parameter like this:

getCall: {
        url: `${servicePathPrefixOrDomain}/api/getCall?_t={new Date().getTime()}`
         cache: false
    }

In this way for every ajax call the url will be unique due to different timestamp and browser will not cache the response.

0👍

Is solved adding the next code in the header:

const requestConfigJSON = {
    headers: {
        'Content-Type': 'application/json',
        'Cache-Control': 'no-cache'
    }
};

Leave a comment