mirror of
https://github.com/Crosstalk-Solutions/project-nomad.git
synced 2026-03-28 19:49:25 +01:00
19 lines
551 B
TypeScript
19 lines
551 B
TypeScript
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
|