about summary refs log tree commit diff
path: root/src/state/queries
diff options
context:
space:
mode:
authorSamuel Newman <mozzius@protonmail.com>2024-04-16 20:38:41 +0100
committerGitHub <noreply@github.com>2024-04-16 20:38:41 +0100
commit2974b407be8c1153fb2dd9053fbfd23b735aada5 (patch)
treec1bc27f9c4a1c08ca0a2ea5326d4d3238888d31d /src/state/queries
parent45e572b212691e100f11c67c89d7d65067c5ad51 (diff)
downloadvoidsky-2974b407be8c1153fb2dd9053fbfd23b735aada5.tar.zst
add sort to searchPosts request (#3581)
Diffstat (limited to 'src/state/queries')
-rw-r--r--src/state/queries/search-posts.ts19
1 files changed, 7 insertions, 12 deletions
diff --git a/src/state/queries/search-posts.ts b/src/state/queries/search-posts.ts
index 1822577c9..1106f7461 100644
--- a/src/state/queries/search-posts.ts
+++ b/src/state/queries/search-posts.ts
@@ -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,