mirror of
https://github.com/jc21/nginx-proxy-manager.git
synced 2024-08-30 18:22:48 +00:00
17 lines
420 B
TypeScript
17 lines
420 B
TypeScript
import { getHealth, HealthResponse } from "api/npm";
|
|
import { useQuery } from "react-query";
|
|
|
|
const fetchHealth = () => getHealth();
|
|
|
|
const useHealth = (options = {}) => {
|
|
return useQuery<HealthResponse, Error>("health", fetchHealth, {
|
|
refetchOnWindowFocus: false,
|
|
retry: 5,
|
|
refetchInterval: 15 * 1000, // 15 seconds
|
|
staleTime: 14 * 1000, // 14 seconds
|
|
...options,
|
|
});
|
|
};
|
|
|
|
export { fetchHealth, useHealth };
|