mirror of
https://github.com/cheveguerra/whaticket-community.git
synced 2026-04-17 19:37:02 +00:00
improvement: open ticket on notification click
This commit is contained in:
@@ -308,12 +308,23 @@ const TicketsList = () => {
|
||||
});
|
||||
};
|
||||
|
||||
// let notification;
|
||||
|
||||
const showDesktopNotification = data => {
|
||||
console.log(data);
|
||||
const options = {
|
||||
body: `${data.message.body} - ${format(new Date(), "HH:mm")}`,
|
||||
icon: data.contact.profilePicUrl,
|
||||
};
|
||||
new Notification(`Mensagem de ${data.contact.name}`, options);
|
||||
let notification = new Notification(
|
||||
`Mensagem de ${data.contact.name}`,
|
||||
options
|
||||
);
|
||||
notification.onclick = function (event) {
|
||||
event.preventDefault(); //
|
||||
window.open(`/chat/${data.ticket.id}`, "_blank");
|
||||
};
|
||||
|
||||
document.getElementById("sound").play();
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user