mirror of
https://github.com/NginxProxyManager/nginx-proxy-manager.git
synced 2025-12-21 19:39:17 +00:00
18 lines
457 B
TypeScript
18 lines
457 B
TypeScript
import { useQuery } from "@tanstack/react-query";
|
|
import { type Certificate, getCertificate } from "src/api/backend";
|
|
|
|
const fetchCertificate = (id: number) => {
|
|
return getCertificate(id, ["owner"]);
|
|
};
|
|
|
|
const useCertificate = (id: number, options = {}) => {
|
|
return useQuery<Certificate, Error>({
|
|
queryKey: ["certificate", id],
|
|
queryFn: () => fetchCertificate(id),
|
|
staleTime: 60 * 1000, // 1 minute
|
|
...options,
|
|
});
|
|
};
|
|
|
|
export { useCertificate };
|