import React, { useEffect } from 'react'; import { FormattedMessage } from 'react-intl'; import { closeModal } from 'soapbox/actions/modals'; import CopyableInput from 'soapbox/components/copyable-input'; import SafeEmbed from 'soapbox/components/safe-embed'; import { Modal, Stack, Text, Divider } from 'soapbox/components/ui'; import { useAppDispatch } from 'soapbox/hooks'; import useEmbed from 'soapbox/queries/embed'; interface IEmbedModal { url: string, onError: (error: any) => void, } const EmbedModal: React.FC = ({ url, onError }) => { const dispatch = useAppDispatch(); const { data: embed, error, isError } = useEmbed(url); useEffect(() => { if (error && isError) { onError(error); } }, [isError]); const handleClose = () => { dispatch(closeModal('EMBED')); }; return ( } onClose={handleClose} >
); }; export default EmbedModal;