mirror of
https://github.com/cheveguerra/whaticket-community.git
synced 2026-04-20 20:59:16 +00:00
improvement: open ticket on notification click
This commit is contained in:
@@ -308,12 +308,23 @@ const TicketsList = () => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// let notification;
|
||||||
|
|
||||||
const showDesktopNotification = data => {
|
const showDesktopNotification = data => {
|
||||||
|
console.log(data);
|
||||||
const options = {
|
const options = {
|
||||||
body: `${data.message.body} - ${format(new Date(), "HH:mm")}`,
|
body: `${data.message.body} - ${format(new Date(), "HH:mm")}`,
|
||||||
icon: data.contact.profilePicUrl,
|
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();
|
document.getElementById("sound").play();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user