'use client' import { useCallback } from 'react' import { useAsyncResource } from '@/hooks/useAsyncResource' import { GET_ADMIN_USER_DETAIL } from '@/services/adminUserDetail' export const useAdminUserDetail = (userId: string) => { const load = useCallback( async (signal: AbortSignal) => { const result = await GET_ADMIN_USER_DETAIL(userId, { errorMode: 'silent', signal }) if (!result.ok) throw new Error(result.error.message || 'دریافت اطلاعات کاربر ناموفق بود') return result.data }, [userId] ) return useAsyncResource(load, { cacheKey: `admin-user:${userId}`, enabled: Boolean(userId), retries: 1 }) }