I'm middle of a PWA app and one of the problems facing is versioning, once the post cached using Service Worker and if any change amended(ex: if it is an event post, the event end date may be extended.) to the post still user sees the old post.
https://sample.com/event/this-will-happen-after-covid?v=12042020
If I can add 'Date Updated' as a parameter of the URL I hope I can manage with. If there better approach, much appreciated.
The second question about csrf token
please check the example.
let api = '/actions/favourite/get-favourite-ids';
let data = {
'id': {{ currentUser.id }}
};
data['{{ craft.app.config.general.csrfTokenName }}'] = '{{ craft.app.request.csrfToken }}';
$.ajax({
url: api,
type: 'POST',
data: data,
dataType: 'json',
async: false,
success: function (result) {
addFavoriteIcon(result)
},
error: function(jqXHR, textStatus, errorThrown) {
},beforeSend: function(){
},
complete: function(){
}
});
I realised that due to csrf token
is also cached, 400 error produced.
What are the better approach get rid of these two issues?