diff --git a/src/components/pages/HomePage.tsx b/src/components/pages/HomePage.tsx index 4e8691b..51353c2 100644 --- a/src/components/pages/HomePage.tsx +++ b/src/components/pages/HomePage.tsx @@ -1,8 +1,6 @@ -import { useQuery, useQueries } from '@tanstack/react-query'; +import { useQuery } from '@tanstack/react-query'; import Navigation from '../common/Navigation'; -import { fetchUsers, fetchUserCards } from '../../utils/api'; -import SpecialCard from '../card/SpecialCard'; -import type { Card } from '../../types'; +import { fetchUsers } from '../../utils/api'; export default function HomePage() { @@ -11,30 +9,6 @@ export default function HomePage() { queryFn: () => fetchUsers() }); - // Get all users with fav cards - const usersWithFav = users?.data?.filter(user => user.fav && user.fav !== '0') || []; - - // Fetch cards for each user with fav - const favCardQueries = useQueries({ - queries: usersWithFav.map(user => ({ - queryKey: ['userCards', user.id], - queryFn: () => fetchUserCards(user.id), - enabled: !!user.id - })) - }); - - // Extract fav cards - const favCards: { user: typeof usersWithFav[0], card: Card }[] = []; - usersWithFav.forEach((user, index) => { - const userCards = favCardQueries[index]?.data?.data; - if (userCards && user.fav) { - const favCard = userCards.find(card => card.id === parseInt(user.fav)); - if (favCard) { - favCards.push({ user, card: favCard }); - } - } - }); - if (isLoading) { return (