moved page editing api methodology to its own api class, session check for pages section
parent
ed2105edcc
commit
9cf0cbfbe4
@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
class PagesAPI
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
}
|
||||
|
||||
public static function handlePageTask($request, $args)
|
||||
{
|
||||
$task = $args["fourth"];
|
||||
switch ($task) {
|
||||
case "delete":
|
||||
case "create":
|
||||
case "write":
|
||||
$result = (new Book("../content/pages"))->editPage($task, $request);
|
||||
break;
|
||||
case "add-entry-image":
|
||||
$result = ImagesAPI::uploadImage($request);
|
||||
break;
|
||||
default:
|
||||
$result = [
|
||||
"message" => "Hm, no task. That's unfortunate",
|
||||
"type" => "TASK_NONE",
|
||||
];
|
||||
break;
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue