Use const and early return

This commit is contained in:
Amine Ben hammou
2019-04-11 15:27:54 +02:00
committed by M. Shull
parent b91cc0639d
commit 47a1c22366

View File

@@ -21,8 +21,10 @@ const resumeMailerSending = () => {
}); });
}; };
function MailerError(props) { const MailerError = (props) => {
if (props.mta_log.error && props.mta_log.status === 'paused' && props.mta_log.error.operation !== 'authorization') { if (!props.mta_log.error || props.mta_log.status !== 'paused' || props.mta_log.error.operation === 'authorization') {
return null;
}
if (props.mta_log.error.operation === 'migration') { if (props.mta_log.error.operation === 'migration') {
return ( return (
<div className="mailpoet_notice notice notice-warning"> <div className="mailpoet_notice notice notice-warning">
@@ -61,9 +63,7 @@ function MailerError(props) {
</p> </p>
</div> </div>
); );
} };
return null;
}
MailerError.propTypes = { MailerError.propTypes = {
mta_method: PropTypes.string.isRequired, mta_method: PropTypes.string.isRequired,