mirror of
https://github.com/jc21/nginx-proxy-manager.git
synced 2024-08-30 18:22:48 +00:00
20 lines
452 B
TypeScript
20 lines
452 B
TypeScript
import { getUpstreamNginxConfig } from "api/npm";
|
|
import { useQuery } from "react-query";
|
|
|
|
const fetchUpstreamNginxConfig = (id: any) => {
|
|
return getUpstreamNginxConfig(id);
|
|
};
|
|
|
|
const useUpstreamNginxConfig = (id: number, options = {}) => {
|
|
return useQuery<string, Error>(
|
|
["upstream-nginx-config", id],
|
|
() => fetchUpstreamNginxConfig(id),
|
|
{
|
|
staleTime: 30 * 1000, // 30 seconds
|
|
...options,
|
|
},
|
|
);
|
|
};
|
|
|
|
export { useUpstreamNginxConfig };
|