Aurelia Http fetch returns cached data

So, I am new to Aurelia and web development in general.

I currently have a view with a data table. After editing the record and returning to the table, I call my function to make another API call, but instead, my browser returns 304, not changed (although the values ​​in the database were updated).

When I enable "always update from server" in Edge, I get the results as I expected. Is there any way to tell that this Http request always calls the API, and not from the cache?

+5
source share
1 answer

At the top of my head, you can change the url you get to have some junk at the end of it.

this.http.get(url + "?_t=" + new Date().getTime(), data).done(function(values) { //do stuff }); 

Not pretty, but it should work.

Similarly, you can use your own call.

 nonCachedGet(url, data) { return this.http.createRequest(url) .asGet() .withContent(data) .withParams({ _t: new Date().getTime() }) .send(); } 

It does not seem that there are any specific settings indicating that the built-in request methods are not cached.

+4
source

All Articles