Files
BayIQ-UI/src/features/dashboard/hooks/useGetSystemHealth.ts
Toba Ojo 59bcb3c45b - Enhance layout and responsiveness of camera components
- update system health hook for periodic refetching
2025-12-03 13:39:18 +00:00

18 lines
479 B
TypeScript

import { useQuery } from "@tanstack/react-query";
import { CAMBASE } from "../../../utils/config";
const fetchData = async () => {
const response = await fetch(`${CAMBASE}/api/system-health`);
if (!response.ok) throw new Error("Cannot get System overview");
return response.json();
};
export const useGetSystemHealth = () => {
const query = useQuery({
queryKey: ["fetchSystemData"],
queryFn: fetchData,
refetchInterval: 300000,
});
return { query };
};