diff --git a/src/components/NotificationCard/NotificationCard.tsx b/src/components/NotificationCard/NotificationCard.tsx
index b1baa66..5412b0d 100644
--- a/src/components/NotificationCard/NotificationCard.tsx
+++ b/src/components/NotificationCard/NotificationCard.tsx
@@ -14,7 +14,7 @@ function NotificationCard({ notifications, deleteNotification }: NotificationCar
- Le {formatDate(String(notification.created_at))} à {formatTime(String(notification.created_at))}
+ Le {formatDate(notification.created_at)} à {formatTime(notification.created_at)}
[newNotification, ...prev]);
diff --git a/src/utils/echo/listeners/userNotificationsListener.js b/src/utils/echo/listeners/userNotificationsListener.js
index 7fa193d..253378d 100644
--- a/src/utils/echo/listeners/userNotificationsListener.js
+++ b/src/utils/echo/listeners/userNotificationsListener.js
@@ -3,12 +3,14 @@ export const userNotificationsListener = (echo, userData, setNotifications, setU
const channelName = `user.${userData.id}`;
const handleNotification = (content) => {
+
const newNotification = {
id: Date.now(),
content,
- created_at: Date.now(),
+ created_at: new Date().toISOString(),
pivot: { unread: 1 }
};
+
setNotifications(prev => [newNotification, ...prev]);
setUnreadNotification(true);
};
@@ -25,5 +27,8 @@ export const userNotificationsListener = (echo, userData, setNotifications, setU
})
.listen('.volunteer.unassigned.to.task', (event) => {
handleNotification(`Vous avez été désassigné de la tâche ${event.task.name} de l'événement ${event.event.name}`);
+ })
+ .listen('.volunteer.role.updated', (event) => {
+ handleNotification(`Votre rôle a changé pour : ${event.role} !`);
});
};
\ No newline at end of file