Skip to content

Commit

Permalink
Fix bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
Xwilarg committed Dec 30, 2024
1 parent 60c18bb commit 3df5d90
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
8 changes: 8 additions & 0 deletions web/src/common/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ export async function getApiToken(pwd, onSuccess, onFailure) {
})
.catch((err) => {
document.getElementById("error-log").innerHTML += `<div class="error">Login failed: ${err}</div>`;
console.error(err);
onFailure();
logOff();
});
Expand All @@ -115,6 +116,7 @@ export async function generatePassword(pwd) {
})
.catch((err) => {
alert(`Request failed: ${err}`);
console.error(err);
});
}

Expand All @@ -138,6 +140,7 @@ export async function uploadSong(data, onSuccess, onFailure) {
})
.catch((err) => {
alert(`Failed to upload song: ${err}`);
console.error(err);
onFailure();
});
}
Expand All @@ -164,6 +167,7 @@ export async function archiveSong(key, onSuccess, onFailure) {
})
.catch((err) => {
alert(`Failed to archive song: ${err}`);
console.error(err);
onFailure();
});
}
Expand Down Expand Up @@ -191,6 +195,7 @@ export async function favoriteSong(key, toggle, onSuccess, onFailure) {
})
.catch((err) => {
alert(`Failed to favorite song: ${err}`);
console.error(err);
onFailure();
});
}
Expand Down Expand Up @@ -218,6 +223,7 @@ export async function repairSong(key, onSuccess, onFailure) {
})
.catch((err) => {
alert(`Failed to repair song: ${err}`);
console.error(err);
onFailure();
});
}
Expand All @@ -242,6 +248,7 @@ export async function updateSong(data, onSuccess, onFailure) {
})
.catch((err) => {
alert(`Failed to update song: ${err}`);
console.error(err);
onFailure();
});
}
Expand All @@ -263,5 +270,6 @@ export async function validateIntegrity() {
})
.catch((err) => {
alert(`Unexpected error: ${err}`);
console.error(err);
});
}
8 changes: 4 additions & 4 deletions web/src/main/song.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,11 @@ export function spawnSongNode(curr, id, isMinimalist) {
updateSong(data, () => {
target.hidden = true;

if (data["Tags"] !== undefined) {
curr.tags = data["Tags"];
if (data.get("Tags") !== undefined) {
curr.tags = data.get("Tags");
}
curr.name = data["Name"];
curr.artist = data["Artist"];
curr.name = data.get("Name");
curr.artist = data.get("Artist");

updateSingleSongDisplay(document.getElementById(idContainer), curr);
}, () => {
Expand Down

0 comments on commit 3df5d90

Please sign in to comment.