You've already forked nginx-proxy-manager
mirror of
https://github.com/NginxProxyManager/nginx-proxy-manager.git
synced 2025-11-01 05:31:05 +03:00
18 lines
600 B
TypeScript
18 lines
600 B
TypeScript
import { useQuery } from "@tanstack/react-query";
|
|
import { getRedirectionHosts, type RedirectionHost, type RedirectionHostExpansion } from "src/api/backend";
|
|
|
|
const fetchRedirectionHosts = (expand?: RedirectionHostExpansion[]) => {
|
|
return getRedirectionHosts(expand);
|
|
};
|
|
|
|
const useRedirectionHosts = (expand?: RedirectionHostExpansion[], options = {}) => {
|
|
return useQuery<RedirectionHost[], Error>({
|
|
queryKey: ["redirection-hosts", { expand }],
|
|
queryFn: () => fetchRedirectionHosts(expand),
|
|
staleTime: 60 * 1000,
|
|
...options,
|
|
});
|
|
};
|
|
|
|
export { fetchRedirectionHosts, useRedirectionHosts };
|