upvoting is now fully functional
This commit is contained in:
		@@ -123,18 +123,16 @@ export function vote(entryID, up) {
 | 
			
		||||
    );
 | 
			
		||||
    console.log(fetchURL); // TODO: remove
 | 
			
		||||
    fetch(fetchURL, {
 | 
			
		||||
        method: "PUT", //mode: 'no-cors'
 | 
			
		||||
        method: "PUT",
 | 
			
		||||
        headers: {
 | 
			
		||||
            'Content-Type': 'application/json',
 | 
			
		||||
            // Add other headers as needed
 | 
			
		||||
        },
 | 
			
		||||
    });
 | 
			
		||||
    /*.then(resp => resp.json()) // TODO: wait for backend
 | 
			
		||||
        }})
 | 
			
		||||
    .then(resp => resp.json())
 | 
			
		||||
    .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) + ']')
 | 
			
		||||
    dataset.querySelector("span").innerText++; // TODO: replace by parsed vote
 | 
			
		||||
    /*});*/
 | 
			
		||||
    dataset.querySelector("span").innerText = data.upvotes;
 | 
			
		||||
    });
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function incrementPageCount() {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user