read notification on click working
This commit is contained in:
parent
b1e8848fcd
commit
f99e33f80e
5 changed files with 55 additions and 31 deletions
|
|
@ -35,6 +35,7 @@ return [
|
|||
'uuid' => (string) kirby()->user()->uuid(),
|
||||
'role' => (string) kirby()->user()->role(),
|
||||
],
|
||||
'id' => Str::uuid(),
|
||||
'type' => 'content'
|
||||
];
|
||||
|
||||
|
|
|
|||
|
|
@ -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'),
|
||||
|
|
|
|||
13
public/site/plugins/notifications/routes/read.php
Normal file
13
public/site/plugins/notifications/routes/read.php
Normal 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;
|
||||
}
|
||||
];
|
||||
Loading…
Add table
Add a link
Reference in a new issue