Files
BayIQ-UI/src/features/dashboard/hooks/useGetSystemHealth.ts

17 lines
450 B
TypeScript
Raw Normal View History

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