Certificates react table basis

This commit is contained in:
Jamie Curnow
2025-09-17 18:01:00 +10:00
parent efcefe0c17
commit 058f49ceea
10 changed files with 271 additions and 7 deletions

View File

@@ -1,6 +1,7 @@
export * from "./useAccessLists";
export * from "./useAuditLog";
export * from "./useAuditLogs";
export * from "./useCertificates";
export * from "./useDeadHosts";
export * from "./useHealth";
export * from "./useHostReport";

View File

@@ -0,0 +1,17 @@
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 };