diff --git a/public/site/config/routes/validate-brief.php b/public/site/config/routes/validate-brief.php
index 410b022..fb21587 100644
--- a/public/site/config/routes/validate-brief.php
+++ b/public/site/config/routes/validate-brief.php
@@ -35,6 +35,7 @@ return [
'uuid' => (string) kirby()->user()->uuid(),
'role' => (string) kirby()->user()->role(),
],
+ 'id' => Str::uuid(),
'type' => 'content'
];
diff --git a/public/site/plugins/notifications/index.php b/public/site/plugins/notifications/index.php
index f0fa642..6a0219e 100644
--- a/public/site/plugins/notifications/index.php
+++ b/public/site/plugins/notifications/index.php
@@ -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'),
diff --git a/public/site/plugins/notifications/routes/read.php b/public/site/plugins/notifications/routes/read.php
new file mode 100644
index 0000000..6d4e44e
--- /dev/null
+++ b/public/site/plugins/notifications/routes/read.php
@@ -0,0 +1,13 @@
+ '(: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;
+ }
+];
\ No newline at end of file
diff --git a/src/stores/api.js b/src/stores/api.js
index 0f2b3c2..17f483f 100644
--- a/src/stores/api.js
+++ b/src/stores/api.js
@@ -197,7 +197,7 @@ export const useApiStore = defineStore("api", () => {
}),
};
try {
- const response = await fetch("/read-comment.json", headers);
+ const response = await fetch("/read-notification.json", headers);
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
diff --git a/src/views/Notifications.vue b/src/views/Notifications.vue
index 68873ef..4e9c15c 100644
--- a/src/views/Notifications.vue
+++ b/src/views/Notifications.vue
@@ -42,38 +42,34 @@
class="notification | bg-white rounded-lg | p-16 | flow"
:data-status="notification.isRead ? 'read' : 'unread'"
:data-type="notification.type"
+ @click="read(notification)"
>
-
- Nouveau
- {{
- notification.type === "comment" ? "commentaire" : "contenu"
- }}
- {{
- notification.location.project.title
- }}
-
-
- {{ notification.text }}
+
+ Nouveau
+ {{
+ notification.type === "comment" ? "commentaire" : "contenu"
+ }}
+ {{
+ notification.location.project.title
+ }}
+
+ {{ notification.text }} +