read content notification on click

This commit is contained in:
isUnknown 2025-01-15 15:36:43 +01:00
parent 1fae3dd414
commit 495e1c024e
7 changed files with 25 additions and 16 deletions

View file

@ -147,7 +147,10 @@ function handleClick() {
async function read() {
if (getStatus.value !== "unread") return;
try {
const newNotification = await api.readNotification(comment, page.value.uri);
const newNotification = await api.readNotification(
comment.id,
page.value.uri
);
userStore.readNotification(comment.id, route.params.id);
} catch (error) {
console.log("Erreur lors de la lecture de la notification : ", error);

View file

@ -2,10 +2,7 @@
<article
class="notification | bg-white rounded-lg | p-16 | flow"
data-type="content"
@click="
read(notification);
router.push(notification.location.page.uri);
"
@click="readNotification()"
title="Aller au contenu"
>
<header>
@ -16,7 +13,7 @@
>Contenu</strong
>
<span class="notification__client | text-grey-700">{{
notification.location.project.title
notification.project.title
}}</span>
<time
datetime=""
@ -37,8 +34,17 @@
<script setup>
import { useRouter } from "vue-router";
import { useNotificationsStore } from "../../stores/notifications";
import { useUserStore } from "../../stores/user";
import { useApiStore } from "../../stores/api";
const router = useRouter();
const { notification } = defineProps({ notification: Object });
const { formatDate, read } = useNotificationsStore();
const { formatDate } = useNotificationsStore();
const userStore = useUserStore();
const api = useApiStore();
function readNotification() {
api.readNotification(notification.id, notification.project.uri);
userStore.readNotification(notification.id, notification.project.slug);
}
</script>

View file

@ -17,7 +17,7 @@
}}</strong
>
<span class="notification__client | text-grey-700">{{
notification.location.project.title
notification.project.title
}}</span>
<time
datetime=""