a tool for shared writing and social publishing
at update/reader 12 lines 459 B view raw
1import { callRPC } from "app/api/rpc/client"; 2import { ProfileViewDetailed } from "@atproto/api/dist/client/types/app/bsky/actor/defs"; 3import useSWR from "swr"; 4 5export function useProfileFromDid(did: string | undefined) { 6 return useSWR(did ? ["profile-data", did] : null, async () => { 7 const response = await callRPC("get_profile_data", { 8 didOrHandle: did!, 9 }); 10 return response.result.profile as ProfileViewDetailed | undefined; 11 }); 12}