about summary refs log tree commit diff
path: root/src/state/queries/service.ts
blob: df12d6cbc8ecfb6175ee48e4049b4363327fad25 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import {useQuery} from '@tanstack/react-query'

import {useSession} from '#/state/session'

export const RQKEY = (serviceUrl: string) => ['service', serviceUrl]

export function useServiceQuery() {
  const {agent} = useSession()
  return useQuery({
    queryKey: RQKEY(agent.service.toString()),
    queryFn: async () => {
      const res = await agent.com.atproto.server.describeServer()
      return res.data
    },
  })
}