upvoting suppression by local storage now works, there is a bug however with the entries loaded o startup

This commit is contained in:
J-Klinke
2024-07-03 11:27:49 +02:00
parent 20eda5931a
commit 6d34b8c388
3 changed files with 16 additions and 18 deletions

View File

@@ -89,7 +89,7 @@ for (const downvoteButton of downvoteButtons) {
// functions of the main page
function navigateToAdd() {
window.location.href = "/add";
window.location.href = "/add"; //TODO: move to EventListner?
}
function getFilterQuery() {
@@ -154,7 +154,6 @@ export function vote(entryID, up) {
votedButton.disabled = true;
let notVotedButton = dataSet.querySelector(up? ".downvote-btn":".upvote-btn");
notVotedButton.style.visibility = "hidden";
console.log(dataSet.getAttribute("data-id"));
votedIDs.set(dataSet.getAttribute("data-id"), up);
});
@@ -202,8 +201,8 @@ function fetchInitialEntries() {
.then((data) => {
const datasets = data.content.map(dataset => new Dataset(dataset));
for (const dataset of datasets) {
//dataSets.add(dataset);
document.querySelector("#recents .datasets").appendChild(dataset.createDatasetHTMLElement());
document.querySelector("#recents .datasets")
.appendChild(dataset.createDatasetHTMLElement(dataset.getID()));
}
});
@@ -215,8 +214,8 @@ function fetchInitialEntries() {
.then(resp => resp.json())
.then((data) => {
let dataset = new Dataset(data.content[0]);
//dataSets.add(dataset);
document.querySelector("#top .datasets").appendChild(dataset.createDatasetHTMLElement());
document.querySelector("#top .datasets")
.appendChild(dataset.createDatasetHTMLElement(dataset.getID()));
});
}