more admin dashboard polish, some code cleanup

This commit is contained in:
ari melody 2025-11-06 22:08:06 +00:00
parent 65f277b3f2
commit c547fca0d7
Signed by: ari
GPG key ID: CF99829C92678188
27 changed files with 187 additions and 270 deletions

25
admin/static/releases.js Normal file
View file

@ -0,0 +1,25 @@
document.addEventListener('readystatechange', () => {
const newReleaseBtn = document.getElementById("create-release");
if (newReleaseBtn) newReleaseBtn.addEventListener("click", event => {
event.preventDefault();
const id = prompt("Enter an ID for this release:");
if (id == null || id == "") return;
fetch("/api/v1/music", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({id})
}).then(res => {
if (res.ok) location = "/admin/releases/" + id;
else {
res.text().then(err => {
alert(err);
console.error(err);
});
}
}).catch(err => {
alert("Failed to create release. Check the console for details.");
console.error(err);
});
});
});