Added API/Endpoint abstract class
- (re)Added Endpoints folder to both API and Router - fixed syntax in namespaces - xhr.responseJSON is returned to the fail() - fixed Router endpoints (view in browser, cron,...)
This commit is contained in:
23
lib/API/SuccessResponse.php
Normal file
23
lib/API/SuccessResponse.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
namespace MailPoet\API;
|
||||
|
||||
if(!defined('ABSPATH')) exit;
|
||||
|
||||
class SuccessResponse extends Response {
|
||||
public $data;
|
||||
|
||||
function __construct($data = array(), $meta = array(), $status = self::STATUS_OK) {
|
||||
parent::__construct($status, $meta);
|
||||
$this->data = $data;
|
||||
}
|
||||
|
||||
function getData() {
|
||||
if(empty($this->data)) {
|
||||
return false;
|
||||
} else {
|
||||
return array(
|
||||
'data' => $this->data
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user