Certificates react work

- renewal and download
- table columns rendering
- searching
- deleting
This commit is contained in:
Jamie Curnow
2025-10-27 18:08:37 +10:00
parent 7b5c70ed35
commit 0de26f2950
16 changed files with 381 additions and 86 deletions

View File

@@ -2,6 +2,7 @@ export * from "./useAccessList";
export * from "./useAccessLists";
export * from "./useAuditLog";
export * from "./useAuditLogs";
export * from "./useCertificate";
export * from "./useCertificates";
export * from "./useDeadHost";
export * from "./useDeadHosts";

View File

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