From b78317b26d3bcf77979ece42603a834b8cf0ae08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C3=BA=C5=A1=20Hlav=C3=A1=C4=8Dik?= Date: Sat, 14 Dec 2024 15:54:47 +0100 Subject: [PATCH] Pouzi BE query na filtrovanie postov podla seminaru (#525) Filter posts on BE --- src/components/Posts/Posts.tsx | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/components/Posts/Posts.tsx b/src/components/Posts/Posts.tsx index 80ecc100..590ed202 100644 --- a/src/components/Posts/Posts.tsx +++ b/src/components/Posts/Posts.tsx @@ -15,7 +15,7 @@ export const Posts: FC = () => { error: postsError, } = useQuery({ queryKey: ['cms', 'post', 'visible'], - queryFn: () => axios.get('/api/cms/post/visible'), + queryFn: () => axios.get(`/api/cms/post/visible?sites=${seminarId}`), }) const posts = postsData?.data ?? [] @@ -27,11 +27,9 @@ export const Posts: FC = () => { return ( - {posts - .filter((p) => p.sites.includes(seminarId)) - .map((post) => ( - - ))} + {posts.map((post) => ( + + ))} ) }