/** * useTenants Hook * * React hook for accessing tenants list via TanStack Query. * Provides tenants list 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'; import { authenticatedUserStore } from '@/infrastructure/storage/AuthenticatedUserStore'; /** * useTenants Hook * * Fetches tenants list for the current company using TanStack Query. * * @returns TanStack Query result with tenants array and pagination metadata * * @example * ```tsx * function TenantsList() { * const { data, isLoading, error } = useTenants(); * * if (isLoading) return