18 lines
479 B
TypeScript
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 };
|
|
};
|