import { useQuery } from "@tanstack/react-query" import { getTopAlbums, type getItemsArgs } from "api/api" import AlbumDisplay from "./AlbumDisplay" interface Props { period: string artistId?: Number vert?: boolean hideTitle?: boolean } export default function TopThreeAlbums(props: Props) { const { isPending, isError, data, error } = useQuery({ queryKey: ['top-albums', {limit: 3, period: props.period, artist_id: props.artistId, page: 0}], queryFn: ({ queryKey }) => getTopAlbums(queryKey[1] as getItemsArgs), }) if (isPending) { return

Loading...

} if (isError) { return

Error:{error.message}

} console.log(data) return (
{!props.hideTitle &&

Top Three Albums

}
{data.items.map((item, index) => ( ))}
) }