mirror of
https://github.com/NginxProxyManager/nginx-proxy-manager.git
synced 2025-12-21 19:39:17 +00:00
React
This commit is contained in:
17
frontend/src/hooks/useDeadHosts.ts
Normal file
17
frontend/src/hooks/useDeadHosts.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import { type DeadHost, type DeadHostExpansion, getDeadHosts } from "src/api/backend";
|
||||
|
||||
const fetchDeadHosts = (expand?: DeadHostExpansion[]) => {
|
||||
return getDeadHosts(expand);
|
||||
};
|
||||
|
||||
const useDeadHosts = (expand?: DeadHostExpansion[], options = {}) => {
|
||||
return useQuery<DeadHost[], Error>({
|
||||
queryKey: ["dead-hosts", { expand }],
|
||||
queryFn: () => fetchDeadHosts(expand),
|
||||
staleTime: 60 * 1000,
|
||||
...options,
|
||||
});
|
||||
};
|
||||
|
||||
export { fetchDeadHosts, useDeadHosts };
|
||||
Reference in New Issue
Block a user