add starter pack query

This commit is contained in:
Hailey
2024-06-06 21:09:01 -07:00
parent 2e51c48db3
commit 000e4abb2f
+22
View File
@@ -0,0 +1,22 @@
import {AppBskyGraphGetStarterPack} from '@atproto/api'
import {useQuery} from 'react-query'
import {STALE} from 'state/queries/index'
import {useAgent} from 'state/session'
const RQKEY_ROOT = 'starter-pack'
export function useStarterPackQuery({id}: {id: string}) {
const agent = useAgent()
return useQuery<AppBskyGraphGetStarterPack.OutputSchema>({
queryKey: [RQKEY_ROOT, id],
queryFn: async () => {
const res = await agent.app.bsky.graph.getStarterPack({
starterPack: id,
})
return res.data
},
staleTime: STALE.MINUTES.FIVE,
})
}