import { useQuery } from '@tanstack/react-query'
import { listProducts } from '../api/listProducts'
import type { ListProductsParams } from '../types'

export function useProducts(params?: ListProductsParams) {
  return useQuery({
    queryKey: ['products', params],
    queryFn: () => listProducts(params),
  })
}
