diff options
Diffstat (limited to 'src/state/queries/profile.ts')
-rw-r--r-- | src/state/queries/profile.ts | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/state/queries/profile.ts b/src/state/queries/profile.ts index 434269183..e6203550f 100644 --- a/src/state/queries/profile.ts +++ b/src/state/queries/profile.ts @@ -24,6 +24,7 @@ import {STALE} from '#/state/queries' import {track} from '#/lib/analytics/analytics' export const RQKEY = (did: string) => ['profile', did] +export const profilesQueryKey = (handles: string[]) => ['profiles', handles] export function useProfileQuery({did}: {did: string | undefined}) { const {currentAccount} = useSession() @@ -45,6 +46,17 @@ export function useProfileQuery({did}: {did: string | undefined}) { }) } +export function useProfilesQuery({handles}: {handles: string[]}) { + return useQuery({ + staleTime: STALE.MINUTES.FIVE, + queryKey: profilesQueryKey(handles), + queryFn: async () => { + const res = await getAgent().getProfiles({actors: handles}) + return res.data + }, + }) +} + interface ProfileUpdateParams { profile: AppBskyActorDefs.ProfileView updates: |