"use client"; import { useState } from "react"; import { useQuery } from "@tanstack/react-query"; import { Input, PageHeader, EmptyState } from "@/components/ds"; import { loyaltyApi } from "@/modules/loyalty/services/loyalty-api"; import { useTenantId } from "@/hooks/useTenantId"; import { LoyaltyBreadcrumbs } from "@/modules/loyalty/components/LoyaltyBreadcrumbs"; import { LoyaltyPageLoader, LoyaltyPageError } from "@/modules/loyalty/pages/shared"; import { LoyaltyTablePage } from "@/modules/loyalty/design-system"; export default function AuditLogsPage() { const { tenantId } = useTenantId(); const [entityType, setEntityType] = useState("member"); const [entityId, setEntityId] = useState(""); const q = useQuery({ queryKey: ["loyalty", tenantId, "audit", entityType, entityId], queryFn: () => loyaltyApi.audit.list(tenantId!, entityType, entityId), enabled: !!tenantId && !!entityId, }); if (!tenantId) return ; return (
setEntityType(e.target.value)} /> setEntityId(e.target.value)} className="max-w-md" />
{entityId && q.isLoading ? : null} {q.error ? q.refetch()} /> : null} {entityId && q.data ? ( []} /> ) : ( !entityId && )}
); }