mirror of
https://github.com/Dvorinka/swingmusic-extended.git
synced 2026-06-05 04:53:01 +00:00
add functionality to play button on artist page
This commit is contained in:
committed by
Mungai Njoroge
parent
bb95011dff
commit
90dd1a1fe8
@@ -21,6 +21,12 @@ const getArtistData = async (hash: string) => {
|
||||
};
|
||||
|
||||
const getArtistAlbums = async (hash: string, limit = 6) => {
|
||||
interface ArtistAlbums {
|
||||
albums: Album[];
|
||||
eps: Album[];
|
||||
singles: Album[];
|
||||
}
|
||||
|
||||
const { data, error } = await useAxios({
|
||||
get: true,
|
||||
url: paths.api.artist + `/${hash}/albums?limit=${limit}`,
|
||||
@@ -30,7 +36,20 @@ const getArtistAlbums = async (hash: string, limit = 6) => {
|
||||
console.error(error);
|
||||
}
|
||||
|
||||
return data.albums as Album[];
|
||||
return data as ArtistAlbums;
|
||||
};
|
||||
|
||||
export { getArtistData, getArtistAlbums };
|
||||
const getArtistTracks = async (hash: string, offset: number = 0, limit = 6) => {
|
||||
const { data, error } = await useAxios({
|
||||
get: true,
|
||||
url: paths.api.artist + `/${hash}/tracks?offset=${offset}&limit=${limit}`,
|
||||
});
|
||||
|
||||
if (error) {
|
||||
console.error(error);
|
||||
}
|
||||
|
||||
return data.tracks as Track[];
|
||||
};
|
||||
|
||||
export { getArtistData, getArtistAlbums, getArtistTracks };
|
||||
|
||||
Reference in New Issue
Block a user