mirror of
https://github.com/Dvorinka/swingmusic-extended.git
synced 2026-06-05 13:03:02 +00:00
add featured artists in albumview
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
let base_uri = "http://127.0.0.1:9876";
|
||||
|
||||
const getAlbumTracks = async (name, artist) => {
|
||||
const res = await fetch(
|
||||
base_uri +
|
||||
"/albums/" +
|
||||
encodeURIComponent(name.replaceAll("/", "|")) +
|
||||
"::" +
|
||||
encodeURIComponent(artist.replaceAll("/", "|"))
|
||||
);
|
||||
|
||||
if (!res.ok) {
|
||||
const message = `An error has occured: ${res.status}`;
|
||||
throw new Error(message);
|
||||
}
|
||||
|
||||
const data = await res.json();
|
||||
|
||||
return data;
|
||||
};
|
||||
|
||||
const getAlbumArtists = async (name, artist) => {
|
||||
const res = await fetch(
|
||||
base_uri +
|
||||
"/album/" +
|
||||
encodeURIComponent(name.replaceAll("/", "|")) +
|
||||
"/" +
|
||||
encodeURIComponent(artist.replaceAll("/", "|")) +
|
||||
"/artists"
|
||||
);
|
||||
|
||||
if (!res.ok) {
|
||||
const message = `An error has occured: ${res.status}`;
|
||||
throw new Error(message);
|
||||
}
|
||||
|
||||
const data = await res.json();
|
||||
return data.artists;
|
||||
};
|
||||
|
||||
export default {
|
||||
getAlbumTracks,
|
||||
getAlbumArtists,
|
||||
};
|
||||
Reference in New Issue
Block a user