read notification fully working (content, comment and reply)
This commit is contained in:
parent
51409bd090
commit
cce158e80a
6 changed files with 10 additions and 10 deletions
|
|
@ -2,7 +2,7 @@
|
|||
<article
|
||||
:id="`comment-${comment.id}`"
|
||||
class="comment | flow"
|
||||
:data-status="status"
|
||||
:data-status="getStatus"
|
||||
@click="read()"
|
||||
>
|
||||
<header>
|
||||
|
|
@ -70,11 +70,11 @@ const api = useApiStore();
|
|||
const dialog = useDialogStore();
|
||||
|
||||
// Functions
|
||||
const status = computed(() => {
|
||||
const getStatus = computed(() => {
|
||||
const correspondingNotification = userStore.notifications.find(
|
||||
(notification) => notification.id === comment.id
|
||||
);
|
||||
if (correspondingNotification && !correspondingNotification.isread) {
|
||||
if (correspondingNotification && correspondingNotification.isread != "true") {
|
||||
return "unread";
|
||||
}
|
||||
return undefined;
|
||||
|
|
@ -101,9 +101,10 @@ function closeAddField() {
|
|||
}
|
||||
|
||||
async function read() {
|
||||
if (status.value !== "unread") return;
|
||||
if (getStatus.value !== "unread") return;
|
||||
try {
|
||||
const newNotification = await api.readNotification(comment.id);
|
||||
console.log(newNotification);
|
||||
userStore.readNotification(comment.id);
|
||||
} catch (error) {
|
||||
console.log("Erreur lors de la lecture de la notification : ", error);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue