import { exportEgg } from '@/api/admin/egg'; import SpinnerOverlay from '@/components/elements/SpinnerOverlay'; import useFlash from '@/plugins/useFlash'; // import { jsonLanguage } from '@codemirror/lang-json'; // import Editor from '@/components/elements/Editor'; import { useEffect, useState } from 'react'; import Button from '@/components/elements/Button'; import Modal from '@/components/elements/Modal'; import FlashMessageRender from '@/components/FlashMessageRender'; import { useParams } from 'react-router-dom'; import tw from 'twin.macro'; export default ({ className }: { className?: string }) => { const params = useParams<'id'>(); const { clearAndAddHttpError, clearFlashes } = useFlash(); const [visible, setVisible] = useState(false); const [loading, setLoading] = useState(true); const [_content, setContent] = useState | null>(null); useEffect(() => { if (!visible) { return; } clearFlashes('egg:export'); setLoading(true); exportEgg(Number(params.id)) .then(setContent) .catch(error => clearAndAddHttpError({ key: 'egg:export', error })) .then(() => setLoading(false)); }, [visible]); return ( <> { setVisible(false); }} css={tw`relative`} >

Export Egg

{/**/}
); };