import { useQuery } from 'react-query' ; import { useKibana } from '../common/lib/kibana' ; import { PACKS_ID } from './constants' ; export const usePacks = ( { isLive = false , pageIndex = 0 , pageSize = 10000 , sortField = 'updated_at' , sortDirection = 'desc' , } ) => { const { http } = useKibana ( ) . services ; return useQuery ( [ PACKS_ID , { pageIndex , pageSize , sortField , sortDirection } ] , async ( ) => http . get < any > ( '/internal/osquery/packs' , { query : { pageIndex , pageSize , sortField , sortDirection } , } ) , { keepPreviousData : true , refetchInterval : isLive ? 10000 : false , } ) ; } ;