fix: Up and downvote puttons

This commit is contained in:
Erik Foris 2024-06-28 16:29:49 +02:00
parent 8a1b9c75c6
commit 43646493e1

View File

@ -121,13 +121,19 @@ export function vote(entryID, up) {
baseURL,
);
console.log(fetchURL); // TODO: remove
fetch(fetchURL, {method: "post", mode: 'no-cors'});
/*.then(resp => resp.json()) // TODO: wait for backend
.then((data) => {
console.log(data.content); // TODO: remove*/
let dataset = document.querySelector('[data-id= ' + CSS.escape(entryID) + ']')
dataset.querySelector("span").innerText++; // TODO: replace by parsed vote
/*});*/
fetch(fetchURL, {
method: "PUT", //mode: 'no-cors'
headers: {
'Content-Type': 'application/json',
// Add other headers as needed
},
});
/*.then(resp => resp.json()) // TODO: wait for backend
.then((data) => {
console.log(data.content); // TODO: remove*/
let dataset = document.querySelector('[data-id= ' + CSS.escape(entryID) + ']')
dataset.querySelector("span").innerText++; // TODO: replace by parsed vote
/*});*/
}
function incrementPageCount() {