resolve datetime conflict for notifications
This commit is contained in:
1 parent
dbed114843
commit
72d2cfae27
5 files changed
+12
-5
No files matched your search
@@ -6,7 +6,7 @@ export const adminNotificationsListener = (echo, userData, setNotifications, set
|
||||
const newNotification = {
|
||||
id: Date.now(),
|
||||
content,
|
||||
created_at: Date.now(),
|
||||
created_at: new Date().toISOString(),
|
||||
pivot: { unread: 1 }
|
||||
};
|
||||
setNotifications(prev => [newNotification, ...prev]);
|
||||
|
||||
@@ -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} !`);
|
||||
});
|
||||
};
|
||||
Reference in new issue
Block a user