Refactor resume sending js code out of PHP
[MAILPOET-1987]
This commit is contained in:
committed by
M. Shull
parent
ced9c549f6
commit
3aa382a060
@@ -1,4 +1,5 @@
|
||||
import jQuery from 'jquery';
|
||||
import MailPoet from 'mailpoet';
|
||||
|
||||
jQuery(($) => {
|
||||
$(document).on('click', '.mailpoet-dismissible-notice .notice-dismiss', function dismiss() {
|
||||
@@ -12,4 +13,18 @@ jQuery(($) => {
|
||||
},
|
||||
});
|
||||
});
|
||||
$(document).on('click', '.notice .mailpoet-js-button-resume-sending', function resumeSending() {
|
||||
const noticeElement = $(this).closest('.notice');
|
||||
MailPoet.Ajax.post({
|
||||
api_version: window.mailpoet_api_version,
|
||||
endpoint: 'mailer',
|
||||
action: 'resumeSending',
|
||||
}).done(() => {
|
||||
noticeElement.slideUp();
|
||||
MailPoet.Notice.success(MailPoet.I18n.t('mailerSendingResumedNotice'));
|
||||
if (window.mailpoet_listing) { window.mailpoet_listing.forceUpdate(); }
|
||||
}).fail((response) => {
|
||||
MailPoet.Notice.showApiErrorNotice(response, { scroll: true });
|
||||
});
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user