mirror of
https://github.com/NginxProxyManager/nginx-proxy-manager.git
synced 2025-12-21 19:39:17 +00:00
Moved v3 code from NginxProxyManager/nginx-proxy-manager-3 to NginxProxyManager/nginx-proxy-manager
This commit is contained in:
16
frontend/src/hooks/useHealth.ts
Normal file
16
frontend/src/hooks/useHealth.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
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 };
|
||||
Reference in New Issue
Block a user