more admin dashboard polish, some code cleanup
This commit is contained in:
parent
65f277b3f2
commit
a66460be19
23 changed files with 163 additions and 231 deletions
25
admin/static/releases.js
Normal file
25
admin/static/releases.js
Normal 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);
|
||||
});
|
||||
});
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue