import { useTranslation } from 'react-i18next'; import { type FC, useEffect, useState } from 'react'; import { Row, Col, Skeleton } from 'antd' import CodeBlock from '@/components/Markdown/CodeBlock'; import { getMemoryApi } from '@/api/memory'; import RbCard from '@/components/RbCard/Card'; import type { Data, Section } from './types'; import Empty from '@/components/Empty' const ApiParameters: FC = () => { const { t } = useTranslation(); const [loading, setLoading] = useState(false) // const [data, setData] = useState(null) const [apiData, setApiData] = useState([]) useEffect(() => { getApiData() }, []) const getApiData = () => { setLoading(true) getMemoryApi().then((res) => { const resp = res as Data || {} // setData(resp) setApiData(resp.sections || []) }) .finally(() => setLoading(false)) } return (

{t('api.pageTitle')}

{t('api.pageSubTitle')}

{loading ? : apiData.length === 0 ? : {apiData.map((api, index) => ( <>
{api.method} {api.path}
{api.desc &&<>
{t('api.desc')}
{api.desc}
} {typeof api.input === 'string' && api.input !== '无' && <>
{t('api.input')}
} {typeof api.output === 'string' && api.output !== '无' && <>
{t('api.output')}
}
))}
}
); }; export default ApiParameters;