Files
ncd-fe/packages/pl-hooks/lib/hooks/accounts/use-account-relationship.ts
nicole mikołajczyk 593b35b21f pl-hooks: actually fix
Signed-off-by: nicole mikołajczyk <git@mkljczk.pl>
2025-10-23 18:26:08 +02:00

18 lines
585 B
TypeScript

import { useQuery } from '@tanstack/react-query';
import { usePlHooksApiClient } from 'pl-hooks/contexts/api-client';
import { usePlHooksQueryClient } from 'pl-hooks/contexts/query-client';
const useAccountRelationship = (accountId?: string) => {
const { client } = usePlHooksApiClient();
const queryClient = usePlHooksQueryClient();
return useQuery({
queryKey: ['relationships', 'entities', accountId],
queryFn: async () => (await client.accounts.getRelationships([accountId!]))[0],
enabled: !!accountId,
}, queryClient);
};
export { useAccountRelationship };