24 lines
No EOL
641 B
PHP
24 lines
No EOL
641 B
PHP
<?php
|
|
|
|
return [
|
|
'pattern' => '(:all)read-notification.json',
|
|
'method' => 'POST',
|
|
'action' => function () {
|
|
$json = file_get_contents('php://input');
|
|
$data = json_decode($json);
|
|
|
|
try {
|
|
$project = page("projects")->findPageOrDraft($data->projectId);
|
|
|
|
$project->readNotification($data->notificationId);
|
|
return json_encode([
|
|
"status" => "success"
|
|
]);
|
|
} catch (\Throwable $th) {
|
|
return json_encode([
|
|
"status" => "error",
|
|
"message" => $th->getMessage() . ' line ' . $th->getLine() . " in file " . $th->getFile()
|
|
]);
|
|
}
|
|
}
|
|
]; |