From 43646493e172de82941f49878e00b76ab26ffc0a Mon Sep 17 00:00:00 2001 From: Erik Foris Date: Fri, 28 Jun 2024 16:29:49 +0200 Subject: [PATCH] fix: Up and downvote puttons --- src/main/resources/static/main.js | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/main/resources/static/main.js b/src/main/resources/static/main.js index e168ef4..a0810a8 100644 --- a/src/main/resources/static/main.js +++ b/src/main/resources/static/main.js @@ -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() {