vchikalkin 0b188ee5ed refactor(contacts): rename masters to invited and update related functionality
- Changed the terminology from "masters" to "invited" and "invitedBy" across the codebase for clarity and consistency.
- Updated the `addContact` function to reflect the new naming convention.
- Refactored API actions and server methods to support the new invited structure.
- Adjusted components and hooks to utilize the updated invited data, enhancing user experience and simplifying logic.
2025-09-08 13:42:30 +03:00

24 lines
838 B
TypeScript

import { getInvited, getInvitedBy } from '@/actions/api/customers';
import { useQuery } from '@tanstack/react-query';
import { useSession } from 'next-auth/react';
export const useInvitedQuery = (props?: Parameters<typeof getInvited>[0]) => {
const { data: session } = useSession();
const telegramId = props?.telegramId || session?.user?.telegramId;
return useQuery({
queryFn: () => getInvited({ telegramId }),
queryKey: ['customer', 'telegramId', telegramId, 'invited'],
});
};
export const useInvitedByQuery = (props?: Parameters<typeof getInvitedBy>[0]) => {
const { data: session } = useSession();
const telegramId = props?.telegramId || session?.user?.telegramId;
return useQuery({
queryFn: () => getInvitedBy({ telegramId }),
queryKey: ['customer', 'telegramId', telegramId, 'invitedBy'],
});
};