16 lines
413 B
TypeScript
16 lines
413 B
TypeScript
|
|
import { useQuery } from "@tanstack/react-query";
|
||
|
|
|
||
|
|
const fetchData = async () => {
|
||
|
|
const response = await fetch(`http://192.168.202.121/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,
|
||
|
|
});
|
||
|
|
return { query };
|
||
|
|
};
|