mirror of
https://github.com/Dvorinka/swingmusic-extended.git
synced 2026-06-04 20:43:04 +00:00
attach artist page link to ArtistName component
+ separate fetching artist albums with fetching artist info + include limit when fetching artist albums + refactor interfaces
This commit is contained in:
committed by
Mungai Njoroge
parent
e54fea2d4d
commit
580dce1da9
@@ -5,22 +5,32 @@ import { Artist, Track, Album } from "@/interfaces";
|
||||
const getArtistData = async (hash: string) => {
|
||||
interface ArtistData {
|
||||
artist: Artist;
|
||||
albums: Album[];
|
||||
tracks: Track[];
|
||||
}
|
||||
|
||||
const { data, error } = await useAxios({
|
||||
get: true,
|
||||
url: paths.api.artist + `/${hash}?limit=6`,
|
||||
url: paths.api.artist + `/${hash}`,
|
||||
});
|
||||
|
||||
if (error) {
|
||||
console.error(error);
|
||||
}
|
||||
|
||||
console.log(data);
|
||||
|
||||
return data as ArtistData;
|
||||
};
|
||||
|
||||
export { getArtistData };
|
||||
const getArtistAlbums = async (hash: string, limit = 6) => {
|
||||
const { data, error } = await useAxios({
|
||||
get: true,
|
||||
url: paths.api.artist + `/${hash}/albums?limit=${limit}`,
|
||||
});
|
||||
|
||||
if (error) {
|
||||
console.error(error);
|
||||
}
|
||||
|
||||
return data.albums as Album[];
|
||||
};
|
||||
|
||||
export { getArtistData, getArtistAlbums };
|
||||
|
||||
Reference in New Issue
Block a user