Files
Aiq-Lite-UI/src/features/dashboard/hooks/useGetSystemHealth.ts
Toba Ojo 97818ca8d9 - Add SystemOverview component and related hooks;
- update Dashboard layout and introduce new UI components
2026-01-07 16:18:14 +00:00

22 lines
588 B
TypeScript

import { useQuery } from "@tanstack/react-query";
import { cambase } from "../../../app/config";
const fetchSystemHealth = async () => {
const response = await fetch(`${cambase}/api/system-health`);
if (!response.ok) throw new Error("Network response was not ok");
return response.json();
};
export const useGetSystemHealth = () => {
const systemHealthQuery = useQuery({
queryKey: ["systemHealth"],
queryFn: fetchSystemHealth,
refetchInterval: 60000,
refetchOnWindowFocus: false,
retry: false,
staleTime: 30000,
});
return { systemHealthQuery };
};