Skip to content

Commit

Permalink
add sort to searchPosts request (#3581)
Browse files Browse the repository at this point in the history
  • Loading branch information
mozzius authored Apr 16, 2024
1 parent 45e572b commit 2974b40
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions src/state/queries/search-posts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,13 @@ export function useSearchPostsQuery({
>({
queryKey: searchPostsQueryKey({query, sort}),
queryFn: async ({pageParam}) => {
// waiting on new APIs
switch (sort) {
// case 'top':
// case 'latest':
default:
const res = await getAgent().app.bsky.feed.searchPosts({
q: query,
limit: 25,
cursor: pageParam,
})
return res.data
}
const res = await getAgent().app.bsky.feed.searchPosts({
q: query,
limit: 25,
cursor: pageParam,
sort,
})
return res.data
},
initialPageParam: undefined,
getNextPageParam: lastPage => lastPage.cursor,
Expand Down

0 comments on commit 2974b40

Please sign in to comment.