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