Add base route for sending preview email

MAILPOET-6092
This commit is contained in:
Oluwaseun Olorunsola
2024-11-13 14:36:40 +01:00
committed by Rostislav Wolný
parent 27d8093f86
commit 87676ccdb6
3 changed files with 27 additions and 14 deletions

View File

@@ -94,6 +94,7 @@ class Email_Editor {
$this->extend_email_post_api();
$this->settings_controller->init();
}
add_action( 'rest_api_init', [ $this, 'register_email_editor_api_routes' ] );
}
/**
@@ -198,6 +199,16 @@ class Email_Editor {
);
}
public function register_email_editor_api_routes() {
register_rest_route('mailpoet-email-editor/v1', '/send_preview_email', [
'methods' => 'POST',
'callback' => array( $this->email_api_controller, 'send_preview_email_data' ),
'permission_callback' => function() {
return current_user_can('edit_posts');
}
]);
}
/**
* Returns the schema for email theme data.
*