import { HostConfig , Health , getHealth } from '@opentrons/api-client' ; import { UseQueryResult , useQuery } from 'react-query' ; import { useHost } from '../api' ; export function useHealthQuery ( ) { const host = useHost ( ) ; const query = useQuery ( [ 'health' , host ] , ( ) => getHealth ( host as HostConfig ) . then ( response => response . data ) , { enabled : host !== null } ) ; return query ; } export function useHealth ( ) { return useHealthQuery ( ) . data ; }