/** * useTenant Hook * * React hook for accessing single tenant data via TanStack Query. * Provides tenant details by ID with automatic caching and background refetch. * * Features: * - Automatic caching and deduplication * - Background refetch on window focus * - Loading and error states * - Automatic retries on failure * * @layer Presentation */ import { useQuery } from '@tanstack/react-query'; import { queryKeys } from '@/lib/query-keys'; import { tenantsApi } from '@/infrastructure/http/api/tenant'; /** * useTenant Hook * * Fetches single tenant by ID using TanStack Query. * * @param tenantId - Tenant ID to fetch (undefined to disable query) * @returns TanStack Query result with tenant data * * @example * ```tsx * function TenantProfile({ tenantId }: { tenantId?: string }) { * const { data: tenant, isLoading, error, refetch } = useTenant(tenantId); * * if (isLoading) return
{tenant.domain}
*Status: {tenant.status}
* *