upvoting is now fully functional
This commit is contained in:
parent
b24b215bc0
commit
b7ecb4500c
@ -123,18 +123,16 @@ export function vote(entryID, up) {
|
|||||||
);
|
);
|
||||||
console.log(fetchURL); // TODO: remove
|
console.log(fetchURL); // TODO: remove
|
||||||
fetch(fetchURL, {
|
fetch(fetchURL, {
|
||||||
method: "PUT", //mode: 'no-cors'
|
method: "PUT",
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
// Add other headers as needed
|
}})
|
||||||
},
|
.then(resp => resp.json())
|
||||||
});
|
|
||||||
/*.then(resp => resp.json()) // TODO: wait for backend
|
|
||||||
.then((data) => {
|
.then((data) => {
|
||||||
console.log(data.content); // TODO: remove*/
|
console.log(data.upvotes); // TODO: remove, check einbauen: data.id === entryID?
|
||||||
let dataset = document.querySelector('[data-id= ' + CSS.escape(entryID) + ']')
|
let dataset = document.querySelector('[data-id= ' + CSS.escape(entryID) + ']')
|
||||||
dataset.querySelector("span").innerText++; // TODO: replace by parsed vote
|
dataset.querySelector("span").innerText = data.upvotes;
|
||||||
/*});*/
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function incrementPageCount() {
|
function incrementPageCount() {
|
||||||
|
Loading…
Reference in New Issue
Block a user