19 lines
588 B
TypeScript
19 lines
588 B
TypeScript
'use client';
|
|
import { getService, getServices } from '@/actions/api/services';
|
|
import { useQuery } from '@tanstack/react-query';
|
|
|
|
export const useServicesQuery = (input: Parameters<typeof getServices>[0]) => {
|
|
const masterId = input.filters?.master?.documentId?.eq;
|
|
|
|
return useQuery({
|
|
queryFn: () => getServices(input),
|
|
queryKey: ['services', 'master', masterId, 'list'],
|
|
});
|
|
};
|
|
|
|
export const useServiceQuery = (input: Parameters<typeof getService>[0]) =>
|
|
useQuery({
|
|
queryFn: () => getService(input),
|
|
queryKey: ['services', 'documentId', input.documentId],
|
|
});
|