minor refactors

This commit is contained in:
geoffrey45
2021-12-29 18:42:38 +03:00
parent 585a403a6c
commit 6dbf8efb90
7 changed files with 83 additions and 109 deletions
+1 -1
View File
@@ -1,7 +1,7 @@
let base_uri = "http://127.0.0.1:9876";
const getAlbum = async (name, artist) => {
const res = await fetch(base_uri + "/albums/" + name + "::" + artist);
const res = await fetch(base_uri + "/albums/" + name.replaceAll("/", "|") + "::" + artist.replaceAll("/", "|"));
if (!res.ok) {
const message = `An error has occured: ${res.status}`;
-26
View File
@@ -1,26 +0,0 @@
const url = "http://127.0.0.1:9876/get/queue";
const getQueue = async (type, id) => {
const res = await fetch(url, {
method: "POST",
headers: {
Accept: "application/json",
"Content-Type": "application/json",
},
body: JSON.stringify({
type: type,
id: id,
}),
});
if (!res.ok) {
const message = `An error has occured: ${res.status}`;
throw new Error(message);
}
const data = await res.json();
return data.songs;
};
export default getQueue;