disabling service worker for api calls
This commit is contained in:
parent
f06a42cb69
commit
5e0b39a1fb
@ -22,7 +22,9 @@
|
||||
if(Number(comments.innerText) !== NaN){
|
||||
commentsCount = Number(comments.innerText);
|
||||
}
|
||||
ajax(serviceUrl + "/UpdatePostCommentsCount?blogUrl=" + siteId + "&postSlug=" + postId, "POST", commentsCount);
|
||||
if(commentsCount !== commentsCountFromResponse){
|
||||
ajax(serviceUrl + "/UpdatePostCommentsCount?blogUrl=" + siteId + "&postSlug=" + postId, "POST", commentsCount);
|
||||
}
|
||||
});
|
||||
var config = { childList: true };
|
||||
observer.observe(target, config);
|
||||
|
||||
@ -148,6 +148,7 @@
|
||||
xhr.open(type, url);
|
||||
xhr.setRequestHeader('XApiKey', 'c6eAXYcNT873TT7BfMgQyS4ii7hxa53TLEUN7pAGaaU=');
|
||||
xhr.setRequestHeader('Content-Type', 'application/json');
|
||||
xhr.setRequestHeader('ngsw-bypass', '');
|
||||
xhr.send(JSON.stringify(payload));
|
||||
});
|
||||
}
|
||||
|
||||
@ -29,6 +29,7 @@
|
||||
const views = document.getElementById("views-count");
|
||||
const likes = document.getElementById("likes-count");
|
||||
const postLikesAndViews = document.getElementById("likes-views");
|
||||
var commentsCountFromResponse = 0;
|
||||
|
||||
postLikesAndViews.style.display = "none";
|
||||
|
||||
@ -60,6 +61,7 @@
|
||||
if(response.postExists){
|
||||
views.innerText = response.views;
|
||||
likes.innerText = response.likes;
|
||||
commentsCountFromResponse = response.comments;
|
||||
postLikesAndViews.style.display = "inline";
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user