fix sort and filter

This commit is contained in:
Michael Freno
2025-12-20 01:59:00 -05:00
parent 921863c602
commit c51771dacd
13 changed files with 391 additions and 658 deletions

View File

@@ -14,13 +14,7 @@ export default function BlogIndex() {
const sort = () => searchParams.sort || "newest";
const filters = () => searchParams.filter || "";
// Pass filters and sortBy to server query
const data = createAsync(() =>
api.blog.getPosts.query({
filters: filters(),
sortBy: sort() as any // Will be validated by Zod schema
})
);
const data = createAsync(() => api.blog.getPosts.query());
return (
<>
@@ -56,7 +50,10 @@ export default function BlogIndex() {
<div class="mx-auto flex w-11/12 flex-col pt-8">
<PostSorting
posts={data()!.posts}
tags={data()!.tags}
privilegeLevel={data()!.privilegeLevel}
filters={filters()}
sort={sort()}
/>
</div>
</Show>