1
0
mirror of https://github.com/NginxProxyManager/nginx-proxy-manager.git synced 2025-11-17 10:22:31 +03:00
Files
nginx-proxy-manager/frontend/src/hooks/useCertificates.ts
2025-10-02 08:12:33 +10:00

18 lines
547 B
TypeScript

import { useQuery } from "@tanstack/react-query";
import { type Certificate, type CertificateExpansion, getCertificates } from "src/api/backend";
const fetchCertificates = (expand?: CertificateExpansion[]) => {
return getCertificates(expand);
};
const useCertificates = (expand?: CertificateExpansion[], options = {}) => {
return useQuery<Certificate[], Error>({
queryKey: ["certificates", { expand }],
queryFn: () => fetchCertificates(expand),
staleTime: 60 * 1000,
...options,
});
};
export { fetchCertificates, useCertificates };