Skip to content

Commit

Permalink
Filter posts on BE
Browse files Browse the repository at this point in the history
  • Loading branch information
Matushl committed Dec 14, 2024
1 parent 4ba507f commit 991f6b6
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/components/Posts/Posts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export const Posts: FC = () => {
error: postsError,
} = useQuery({
queryKey: ['cms', 'post', 'visible'],
queryFn: () => axios.get<IPost[]>('/api/cms/post/visible'),
queryFn: () => axios.get<IPost[]>(`/api/cms/post/visible?sites=${seminarId}`),
})
const posts = postsData?.data ?? []

Expand All @@ -27,11 +27,9 @@ export const Posts: FC = () => {

return (
<Stack gap={5}>
{posts
.filter((p) => p.sites.includes(seminarId))
.map((post) => (
<Post key={post.id} {...post} />
))}
{posts.map((post) => (
<Post key={post.id} {...post} />
))}
</Stack>
)
}

0 comments on commit 991f6b6

Please sign in to comment.