Skip to content

Commit

Permalink
Pouzi BE query na filtrovanie postov podla seminaru (#525)
Browse files Browse the repository at this point in the history
Filter posts on BE
  • Loading branch information
Matushl authored Dec 14, 2024
1 parent 4ba507f commit b78317b
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 b78317b

Please sign in to comment.