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