import type { IEmailInboxPayload } from '@rocket.chat/core-typings'; import { Box, Button, Icon } from '@rocket.chat/fuselage'; import { useToastMessageDispatch, useEndpoint, useTranslation } from '@rocket.chat/ui-contexts'; import type { ReactElement } from 'react'; import React from 'react'; import { GenericTableCell } from '../../../components/GenericTable'; const SendTestButton = ({ id }: { id: IEmailInboxPayload['_id'] }): ReactElement => { const t = useTranslation(); const dispatchToastMessage = useToastMessageDispatch(); const sendTest = useEndpoint('POST', '/v1/email-inbox.send-test/:_id', { _id: id }); const handleOnClick = async (e: React.MouseEvent): Promise => { e.preventDefault(); e.stopPropagation(); try { await sendTest(); dispatchToastMessage({ type: 'success', message: t('Email_sent'), }); } catch (error) { dispatchToastMessage({ type: 'error', message: error, }); } }; return ( ); }; export default SendTestButton;