import { useTranslation } from 'react-i18next' import useSWR from 'swr' import { RiAddLine, } from '@remixicon/react' import Item from './item' import Empty from './empty' import { useModalContext } from '@/context/modal-context' import { fetchApiBasedExtensionList } from '@/service/common' const ApiBasedExtensionPage = () => { const { t } = useTranslation() const { setShowApiBasedExtensionModal } = useModalContext() const { data, mutate, isLoading } = useSWR( '/api-based-extension', fetchApiBasedExtensionList, ) const handleOpenApiBasedExtensionModal = () => { setShowApiBasedExtensionModal({ payload: {}, onSaveCallback: () => mutate(), }) } return (
{ !isLoading && !data?.length && ( ) } { !isLoading && !!data?.length && ( data.map(item => ( mutate()} /> )) ) }
{t('common.apiBasedExtension.add')}
) } export default ApiBasedExtensionPage