diff --git a/client/src/pages/FolxStadlPage.tsx b/client/src/pages/FolxStadlPage.tsx index 1b64e28..aa819a1 100644 --- a/client/src/pages/FolxStadlPage.tsx +++ b/client/src/pages/FolxStadlPage.tsx @@ -20,7 +20,23 @@ export default function FolxStadlPage() { const itemsPerPage = 10; const { data, isLoading } = useQuery<{videos: Video[], total: number}>({ - queryKey: ['/api/videos?limit=200'], + queryKey: ['/api/videos', { limit: 200 }], + queryFn: async ({ queryKey }) => { + const [, params] = queryKey as [string, any]; + const searchParams = new URLSearchParams(); + + Object.entries(params).forEach(([key, value]) => { + if (value !== undefined) { + searchParams.append(key, String(value)); + } + }); + + const response = await fetch(`/api/videos?${searchParams}`); + if (!response.ok) { + throw new Error('Failed to fetch videos'); + } + return response.json(); + }, select: (response) => response || { videos: [], total: 0 } });