You've already forked nginx-proxy-manager
mirror of
https://github.com/NginxProxyManager/nginx-proxy-manager.git
synced 2025-11-17 10:22:31 +03:00
18 lines
547 B
TypeScript
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 };
|