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
551 B
Raw Blame
import { useQuery } from '@tanstack/react-query'
import { ServiceSlim } from '../../types/services'
import api from '~/lib/api'

const useServiceInstalledStatus = (serviceName: string) => {
  const { data, isFetching } = useQuery<ServiceSlim[] | undefined>({
    queryKey: ['installed-services'],
    queryFn: () => api.getSystemServices(),
  })

  const isInstalled = data?.some(
    (service) => service.service_name === serviceName && service.installed
  )

  return { isInstalled, loading: isFetching }
}

export default useServiceInstalledStatus