summaryrefslogtreecommitdiff
path: root/static
diff options
context:
space:
mode:
Diffstat (limited to 'static')
-rw-r--r--static/index.js8
1 files changed, 5 insertions, 3 deletions
diff --git a/static/index.js b/static/index.js
index 991eb6c..0c983a0 100644
--- a/static/index.js
+++ b/static/index.js
@@ -1,17 +1,19 @@
+const ApiLocation = "/api"
let isInfoShown = true;
function GetSongs() {
- fetch("/api/getSongs").then(r => r.json().then(body => {
+ fetch(`${ApiLocation}/getSongs`).then(r => r.json().then(body => {
console.log(body);
}));
}
function SetRandomSong() {
- fetch("/api/randomSong").then(r => r.json().then(body => {
+ fetch(`${ApiLocation}/randomSong`).then(r => r.json().then(body => {
const player = document.getElementById("mainAudio");
console.log(player);
console.log(body);
- player.src = "/api/getSong?name=" + encodeURI(body.Name);
+ document.getElementById("Status").innerHTML = "Loading";
+ player.src = `${ApiLocation}/getSong?name=${encodeURI(body.Name)}`;
document.getElementById("Artist").innerHTML = "Artist: " + body.Meta.Author;
document.getElementById("Title").innerHTML = "Title: " + body.Meta.Name;