Skip to main content
Glama
useClusterOptions.ts985 B
import {useEffect, useState} from 'react'; import {fetcher} from '@/components/Amis/fetcher'; export interface ClusterOption { label: string; value: string; } export function useClusterOptions() { const [options, setOptions] = useState<ClusterOption[]>([]); const [loading, setLoading] = useState(false); const [error, setError] = useState<string | null>(null); useEffect(() => { setLoading(true); fetcher({url: '/params/cluster/option_list', method: 'get'}) .then((res: any) => { if (res?.data?.data?.options) { setOptions(res.data.data?.options); } else { setOptions([]); } }) .catch((err: any) => { setError(err.message || '获取集群列表失败'); setOptions([]); }) .finally(() => setLoading(false)); }, []); return {options, loading, error}; }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/weibaohui/k8m'

If you have feedback or need assistance with the MCP directory API, please join our Discord server