20 lines
704 B
TypeScript
20 lines
704 B
TypeScript
import { useQuery } from '@tanstack/react-query';
|
|
import { getClientProfiles, getClientActiveProfiles } from '../services/client-profiles.service';
|
|
import type { ClientProfileFilters } from '../types/client-profile.types';
|
|
|
|
export function useClientProfiles(clientId: string, filters: ClientProfileFilters) {
|
|
return useQuery({
|
|
queryKey: ['clients', clientId, 'profiles', filters],
|
|
queryFn: () => getClientProfiles(clientId, filters),
|
|
enabled: !!clientId,
|
|
});
|
|
}
|
|
|
|
export function useClientActiveProfiles(clientId: string) {
|
|
return useQuery({
|
|
queryKey: ['clients', clientId, 'profiles', 'active'],
|
|
queryFn: () => getClientActiveProfiles(clientId),
|
|
enabled: !!clientId,
|
|
});
|
|
}
|