project-nomad/admin/inertia/hooks/useSystemInfo.ts
2025-12-01 21:13:44 -08:00

20 lines
564 B
TypeScript

import { useQuery, UseQueryOptions } from '@tanstack/react-query'
import { SystemInformationResponse } from '../../types/system'
import api from '~/lib/api'
export type UseSystemInfoProps = Omit<
UseQueryOptions<SystemInformationResponse>,
'queryKey' | 'queryFn'
> & {}
export const useSystemInfo = (props: UseSystemInfoProps) => {
const queryData = useQuery<SystemInformationResponse>({
...props,
queryKey: ['system-info'],
queryFn: () => api.getSystemInfo(),
refetchInterval: 45000, // Refetch every 45 seconds
})
return queryData
}