Compare commits

...

1 Commits

Author SHA1 Message Date
Eric Bailey 5607462ccb Use api.bsky.app 2024-03-18 16:54:35 -05:00
+9 -5
View File
@@ -1,10 +1,14 @@
import {z} from 'zod'
import {useQuery, useMutation, useQueryClient} from '@tanstack/react-query'
import {AppBskyLabelerDefs} from '@atproto/api'
import {AppBskyLabelerDefs, BskyAgent} from '@atproto/api'
import {getAgent} from '#/state/session'
import {preferencesQueryKey} from '#/state/queries/preferences'
import {STALE, PUBLIC_BSKY_AGENT} from '#/state/queries'
import {STALE} from '#/state/queries'
const API_AGENT = new BskyAgent({
service: 'https://api.bsky.app',
})
export const labelerInfoQueryKey = (did: string) => ['labeler-info', did]
export const labelersInfoQueryKey = (dids: string[]) => [
@@ -27,7 +31,7 @@ export function useLabelerInfoQuery({
enabled: !!did && enabled !== false,
queryKey: labelerInfoQueryKey(did as string),
queryFn: async () => {
const res = await PUBLIC_BSKY_AGENT.app.bsky.labeler.getServices({
const res = await API_AGENT.app.bsky.labeler.getServices({
dids: [did as string],
detailed: true,
})
@@ -41,7 +45,7 @@ export function useLabelersInfoQuery({dids}: {dids: string[]}) {
enabled: !!dids.length,
queryKey: labelersInfoQueryKey(dids),
queryFn: async () => {
const res = await PUBLIC_BSKY_AGENT.app.bsky.labeler.getServices({dids})
const res = await API_AGENT.app.bsky.labeler.getServices({dids})
return res.data.views as AppBskyLabelerDefs.LabelerView[]
},
})
@@ -54,7 +58,7 @@ export function useLabelersDetailedInfoQuery({dids}: {dids: string[]}) {
gcTime: 1000 * 60 * 60 * 6, // 6 hours
staleTime: STALE.MINUTES.ONE,
queryFn: async () => {
const res = await PUBLIC_BSKY_AGENT.app.bsky.labeler.getServices({
const res = await API_AGENT.app.bsky.labeler.getServices({
dids,
detailed: true,
})