import { useQuery } from "@tanstack/react-query" import ArtistLinks from "./ArtistLinks" import { getTopAlbums, getTopTracks, imageUrl, type getItemsArgs } from "api/api" import { Link } from "react-router" import TopListSkeleton from "./skeletons/TopListSkeleton" import TopItemList from "./TopItemList" interface Props { limit: number, period: string, artistId?: Number } export default function TopAlbums (props: Props) { const { isPending, isError, data, error } = useQuery({ queryKey: ['top-albums', {limit: props.limit, period: props.period, artistId: props.artistId, page: 0 }], queryFn: ({ queryKey }) => getTopAlbums(queryKey[1] as getItemsArgs), }) if (isPending) { return (
Loading...
Error:{error.message}
} return (