improvement: open ticket on notification click

This commit is contained in:
canove
2020-07-28 17:03:33 -03:00
parent 5a1b79ea7e
commit 5b0beb8b9c

View File

@@ -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();
};