Fix public.js to follow eslint rules

[MAILPOET-1567]
This commit is contained in:
Rostislav Wolny
2019-01-21 16:55:37 +01:00
parent 784c952229
commit 9562d8704c

View File

@@ -62,18 +62,21 @@ function ( // eslint-disable-line func-names
endpoint: 'subscribers', endpoint: 'subscribers',
action: 'subscribe', action: 'subscribe',
data: formData.data data: formData.data
}).fail(function (response) { // eslint-disable-line func-names })
.fail(function handleFailedPost(response) {
form.find('.mailpoet_validate_error').html( form.find('.mailpoet_validate_error').html(
response.errors.map(function (error) { // eslint-disable-line func-names response.errors.map(function buildErrorMessage(error) {
return error.message; return error.message;
}).join('<br />') }).join('<br />')
).show(); ).show();
}).done(function (response) { // eslint-disable-line func-names })
.done(function handleRecaptcha(response) {
if (window.grecaptcha && formData.recaptcha) { if (window.grecaptcha && formData.recaptcha) {
window.grecaptcha.reset(formData.recaptcha); window.grecaptcha.reset(formData.recaptcha);
} }
return response; return response;
}).done(function (response) { // eslint-disable-line func-names })
.done(function handleSuccess(response) {
// successfully subscribed // successfully subscribed
if ( if (
response.meta !== undefined response.meta !== undefined
@@ -104,7 +107,6 @@ function ( // eslint-disable-line func-names
MailPoet.Iframe.autoSize(window.frameElement); MailPoet.Iframe.autoSize(window.frameElement);
} }
}); });
return false; return false;
}); });
}); });