read notification on click working

This commit is contained in:
isUnknown 2024-12-16 18:14:14 +01:00
parent b1e8848fcd
commit f99e33f80e
5 changed files with 55 additions and 31 deletions

View file

@ -35,6 +35,7 @@ return [
'uuid' => (string) kirby()->user()->uuid(),
'role' => (string) kirby()->user()->role(),
],
'id' => Str::uuid(),
'type' => 'content'
];

View file

@ -7,6 +7,7 @@ load([
Kirby::plugin('adrienpayet/pdc-notifications', [
'routes' => [
require(__DIR__ . '/routes/readAll.php'),
require(__DIR__ . '/routes/read.php')
],
'userMethods' => [
'sendNotification' => require(__DIR__ . '/user-methods/send.php'),

View file

@ -0,0 +1,13 @@
<?php
return [
'pattern' => '(:all)read-notification.json',
'method' => 'POST',
'action' => function () {
$json = file_get_contents('php://input');
$data = json_decode($json);
$newNotifications = kirby()->user()->readNotification($data->notificationId);
return $newNotifications;
}
];