Delete return pages
This commit is contained in:
@@ -30,7 +30,7 @@ class Posts extends Api
|
||||
// Throw 400 error if a required one is missing.
|
||||
$content = Input::post("content");
|
||||
// This one is optional
|
||||
$limit = constrain(0, 30, intval(Input::post("limit", 10)));
|
||||
$limit = constrain(0, 30, intval(Input::get("l", 10)));
|
||||
if (empty($content)) throw ApiError::missingField(["content"]);
|
||||
|
||||
// Get logged in user
|
||||
@@ -77,9 +77,11 @@ class Posts extends Api
|
||||
|
||||
public function delete($id): void
|
||||
{
|
||||
// Fetch ax(0, intval(Input::get("p", 0)));
|
||||
$limit = constrain(0, 30, intval(Input::get("l", 10)));
|
||||
// Try delete, 404 if post was not found.
|
||||
try {
|
||||
Response::json(Post::getByID($id)->delete());
|
||||
Response::json(Post::getByID($id)->delete($limit));
|
||||
} catch (Exception $err) {
|
||||
switch ($err->getMessage()) {
|
||||
case "NotFound":
|
||||
|
||||
Reference in New Issue
Block a user