document.addEventListener('DOMContentLoaded', () => {
  const postView = document.querySelector(".js-post-view");
  if(postView) {
     const postID = postView.getAttribute("data-post-id");
     const apiUrl = retheme_post_view.apiurl;
     fetch(`${apiUrl}?id=${postID}`, {
        method: "GET",
        credentials: "same-origin",
        headers: {
           "Content-Type": "application/x-www-form-urlencoded",
           "Cache-Control": "no-cache",
        },
     })
        .then(response => response.json())
        .then(response => {
           if(response.count) {
              postView.textContent = response.count;
           }
        })
        .catch(console.log);
  }
})