mirror of
https://github.com/tcsenpai/swingmusic.git
synced 2025-07-28 21:51:41 +00:00

+ connect artist page to backend ~ bugs introduced as there are hashing changes in the backend [will fix later]
27 lines
495 B
TypeScript
27 lines
495 B
TypeScript
import { paths } from "@/config";
|
|
import useAxios from "./useAxios";
|
|
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}`,
|
|
});
|
|
|
|
if (error) {
|
|
console.error(error);
|
|
}
|
|
|
|
console.log(data);
|
|
|
|
return data as ArtistData;
|
|
};
|
|
|
|
export { getArtistData };
|