feat: product select
This commit is contained in:
@@ -9,12 +9,12 @@ type Props = {
|
|||||||
}
|
}
|
||||||
const useProductsList = (props: Props) => {
|
const useProductsList = (props: Props) => {
|
||||||
const {clientId, page, itemsPerPage, searchInput} = props;
|
const {clientId, page, itemsPerPage, searchInput} = props;
|
||||||
const {data, refetch} = useQuery({
|
const {data, refetch, isLoading} = useQuery({
|
||||||
queryKey: ['getAllServices', clientId, page, itemsPerPage, searchInput],
|
queryKey: ['getAllServices', clientId, page, itemsPerPage, searchInput],
|
||||||
queryFn: () => ProductService.getProductsByClientId(props)
|
queryFn: () => ProductService.getProductsByClientId(props)
|
||||||
});
|
});
|
||||||
const products = !data ? [] : data.products;
|
const products = !data ? [] : data.products;
|
||||||
const paginationInfo = data?.paginationInfo;
|
const paginationInfo = data?.paginationInfo;
|
||||||
return {products, paginationInfo, refetch}
|
return {products, paginationInfo, refetch, isLoading}
|
||||||
}
|
}
|
||||||
export default useProductsList;
|
export default useProductsList;
|
||||||
Reference in New Issue
Block a user