diff --git a/islands/CardList.tsx b/islands/CardList.tsx index 32bda73..815fead 100644 --- a/islands/CardList.tsx +++ b/islands/CardList.tsx @@ -20,7 +20,7 @@ export type CardListProps = { } export default function CardList( - { limit, builder, ...props }: CardListProps, + { limit, builder, apiRoute, ...props }: CardListProps, ) { const list: Signal = useSignal([]) const ac = new AbortController() @@ -34,7 +34,7 @@ export default function CardList( if (ref.current && useObserver) { const observer = new IntersectionObserver(([entry]) => { if (entry.isIntersecting) { - fillList(list, builder, { limit, ac }) + fillList(list, builder, apiRoute, { limit, ac }) observer.disconnect() } }, { @@ -42,7 +42,7 @@ export default function CardList( }) observer.observe(ref.current) } else { - fillList(list, builder, { limit, ac }) + fillList(list, builder, apiRoute, { limit, ac }) } }) @@ -67,11 +67,12 @@ export default function CardList( function fillList( list: Signal, builder: Builder, + apiRoute: string, { limit, ac }: { limit?: number; ac?: AbortController }, ) { ;(async () => { const propsList = requestApiStream( - 'news/fetchAll', + apiRoute, 'GET', )