create and delete notification for a project working

This commit is contained in:
isUnknown 2025-01-10 15:38:57 +01:00
parent 8c6e21c707
commit 9222069ef5
9 changed files with 105 additions and 52 deletions

View 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());
}
}
];