Update the link for form creation

[MAILPOET-2987]
This commit is contained in:
Pavel Dohnal
2020-06-22 13:29:06 +02:00
committed by Veljko V
parent d7d502dca6
commit 3fac59fcdf
2 changed files with 6 additions and 19 deletions

View File

@@ -127,25 +127,12 @@ const itemActions = [
class FormList extends React.Component {
createForm = () => {
MailPoet.Ajax.post({
api_version: window.mailpoet_api_version,
endpoint: 'forms',
action: 'create',
}).done((response) => {
MailPoet.trackEvent('Forms > Add New', {
'MailPoet Free version': window.mailpoet_version,
});
setTimeout(() => {
window.location = window.mailpoet_form_edit_url + response.data.id;
}, 200);
}).fail((response) => {
if (response.errors.length > 0) {
MailPoet.Notice.error(
response.errors.map((error) => error.message),
{ scroll: true }
);
}
MailPoet.trackEvent('Forms > Add New', {
'MailPoet Free version': window.mailpoet_version,
});
setTimeout(() => {
window.location = window.mailpoet_form_edit_url;
}, 200); // leave some time for the event to track
};
renderItem = (form, actions) => {

View File

@@ -16,7 +16,7 @@
var mailpoet_listing_per_page = <%= items_per_page %>;
var mailpoet_segments = <%= json_encode(segments) %>;
var mailpoet_form_edit_url =
"<%= admin_url('admin.php?page=mailpoet-form-editor&id=') %>";
"<%= admin_url('admin.php?page=mailpoet-form-editor') %>";
var mailpoet_beacon_articles = [
'5e43d3ec2c7d3a7e9ae79da9',
'5e3a166204286364bc94dda4',