From 759bb90e18aebf08e84344b3e4b1748802120709 Mon Sep 17 00:00:00 2001 From: Julien Oculi Date: Wed, 10 Jul 2024 17:46:22 +0200 Subject: [PATCH] fix(island): :bug: replace old hard coded fetch endpoint --- islands/CardList.tsx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) 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', )