From 991f6b6b0cfb068a7a9d45d6128481fe648e3c77 Mon Sep 17 00:00:00 2001 From: matushl Date: Sat, 14 Dec 2024 15:49:46 +0100 Subject: [PATCH] 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) => ( + + ))} ) }