import { useQuery } from '@tanstack/react-query'; import { api } from '../client'; export function useAgents(status?: string) { return useQuery({ queryKey: ['agents', status], queryFn: async () => { const { data, error } = await api.GET('/agents', { params: { query: status ? { status } : {} }, }); if (error) throw new Error('Failed to load agents'); return data!; }, }); }