[SDK] Migrate chat convo queries to the chat client (#11357)
Co-authored-by: Claude Fable 5 <noreply@anthropic.com> Co-authored-by: Matthieu Sieben <matthieusieben@users.noreply.github.com>
This commit is contained in:
@@ -9,8 +9,8 @@ import {
|
||||
useInfiniteQuery,
|
||||
} from '@tanstack/react-query'
|
||||
|
||||
import {DM_SERVICE_HEADERS} from '#/lib/constants'
|
||||
import {useAgent} from '#/state/session'
|
||||
import {useChatClient} from '#/state/session'
|
||||
import {chat} from '#/lexicons'
|
||||
|
||||
const DEFAULT_LIMIT = 10
|
||||
|
||||
@@ -26,17 +26,16 @@ export function useListConvoRequests({
|
||||
enabled?: boolean
|
||||
limit?: number
|
||||
} = {}) {
|
||||
const agent = useAgent()
|
||||
const client = useChatClient()
|
||||
|
||||
return useInfiniteQuery({
|
||||
enabled,
|
||||
queryKey: RQKEY(limit),
|
||||
queryFn: async ({pageParam}) => {
|
||||
const {data} = await agent.chat.bsky.convo.listConvoRequests(
|
||||
{limit, cursor: pageParam},
|
||||
{headers: DM_SERVICE_HEADERS},
|
||||
)
|
||||
return data
|
||||
return await client.call(chat.bsky.convo.listConvoRequests, {
|
||||
limit,
|
||||
cursor: pageParam,
|
||||
})
|
||||
},
|
||||
initialPageParam: undefined as RQPageParam,
|
||||
getNextPageParam: lastPage => lastPage.cursor,
|
||||
|
||||
Reference in New Issue
Block a user