Add tracking unauthorized emails in modal

[MAILPOET-3881]
This commit is contained in:
Jan Lysý
2021-10-29 11:06:35 +02:00
committed by Veljko V
parent 3c8fa566ed
commit 9e4888dc46

View File

@@ -144,6 +144,9 @@ const SetFromAddressModal = ({ onRequestClose, setAuthorizedAddress }: Props) =>
notices.success(getSuccessMessage(), { timeout: false });
} catch (e) {
const error = e.errors && e.errors[0] ? e.errors[0] : null;
if (error.error === 'unauthorized') {
MailPoet.trackEvent('Unauthorized email used', { 'Unauthorized email source': 'modal' });
}
const message = getErrorMessage(error, address);
addressValidator.addError('saveError', { message });
}