Skip to content

Project NOMAD is an offline-first knowledge and education server. Wikipedia, thousands of books, courses, maps, and optional local AI, all running on hardware you own with no internet required.

TypeScript
600 B
Raw Blame
import { useQuery, UseQueryOptions } from '@tanstack/react-query'
import { SystemInformationResponse } from '../../types/system'
import api from '~/lib/api'

export type UseSystemInfoProps = Omit<
  UseQueryOptions<SystemInformationResponse | undefined>,
  'queryKey' | 'queryFn'
> & {}

export const useSystemInfo = (props: UseSystemInfoProps) => {
  const queryData = useQuery<SystemInformationResponse | undefined>({
    ...props,
    queryKey: ['system-info'],
    queryFn: async () => await api.getSystemInfo(),
    refetchInterval: 45000, // Refetch every 45 seconds
  })

  return queryData
}