From 5607462ccb663c0a63c9f8b4d702d128d98e3ebe Mon Sep 17 00:00:00 2001 From: Eric Bailey Date: Mon, 18 Mar 2024 16:54:35 -0500 Subject: [PATCH] Use api.bsky.app --- src/state/queries/labeler.ts | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/state/queries/labeler.ts b/src/state/queries/labeler.ts index c405a6b575..7a1049c91e 100644 --- a/src/state/queries/labeler.ts +++ b/src/state/queries/labeler.ts @@ -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, })