Files
nginx-proxy-manager/frontend/src/hooks/useAuditLogs.ts
2025-09-15 15:56:24 +10:00

18 lines
509 B
TypeScript

import { useQuery } from "@tanstack/react-query";
import { type AuditLog, type AuditLogExpansion, getAuditLogs } from "src/api/backend";
const fetchAuditLogs = (expand?: AuditLogExpansion[]) => {
return getAuditLogs(expand);
};
const useAuditLogs = (expand?: AuditLogExpansion[], options = {}) => {
return useQuery<AuditLog[], Error>({
queryKey: ["audit-logs", { expand }],
queryFn: () => fetchAuditLogs(expand),
staleTime: 10 * 1000,
...options,
});
};
export { fetchAuditLogs, useAuditLogs };