- improved the system status ui
This commit is contained in:
15
src/features/dashboard/hooks/useGetSystemHealth.ts
Normal file
15
src/features/dashboard/hooks/useGetSystemHealth.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
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 };
|
||||
};
|
||||
Reference in New Issue
Block a user