import type { IEmailInboxPayload } from '@rocket.chat/core-typings'; import { Button } from '@rocket.chat/fuselage'; import { GenericTableCell } from '@rocket.chat/ui-client'; import { useToastMessageDispatch, useEndpoint } from '@rocket.chat/ui-contexts'; import type { MouseEvent } from 'react'; import { useTranslation } from 'react-i18next'; export type SendTestButtonProps = { id: IEmailInboxPayload['_id'] }; const SendTestButton = ({ id }: SendTestButtonProps) => { const { t } = useTranslation(); const dispatchToastMessage = useToastMessageDispatch(); const sendTest = useEndpoint('POST', '/v1/email-inbox.send-test/:_id', { _id: id }); const handleOnClick = async (e: 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;