create and delete notification for a project working
This commit is contained in:
parent
8c6e21c707
commit
9222069ef5
9 changed files with 105 additions and 52 deletions
20
public/site/plugins/notifications/routes/delete.php
Normal file
20
public/site/plugins/notifications/routes/delete.php
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
'pattern' => '(:all)delete-user-notification.json',
|
||||
'method' => 'POST',
|
||||
'action' => function () {
|
||||
$json = file_get_contents('php://input');
|
||||
$data = json_decode($json);
|
||||
|
||||
try {
|
||||
kirby()->user()->deleteNotification($data->notificationId);
|
||||
return json_encode([
|
||||
"status" => "success",
|
||||
"message" => "Notification n°{$data->notificationId} correctly deleted for all \"{$$project->title()}\" managers."
|
||||
]);
|
||||
} catch (\Throwable $th) {
|
||||
return json_encode($th->getMessage() . ' line ' . $th->getLine());
|
||||
}
|
||||
}
|
||||
];
|
||||
Loading…
Add table
Add a link
Reference in a new issue