fix: notificationclick event
All checks were successful
Deploy to Netlify / Deploy to Netlify (push) Successful in 1m56s

This commit is contained in:
Nathan Lamy 2025-08-21 12:22:17 +02:00
parent fbd7138af9
commit 21cb6a8b9f

View file

@ -22,10 +22,11 @@ const BASE_URL = "https://khollise.fr";
self.addEventListener("notificationclick", function (event) { self.addEventListener("notificationclick", function (event) {
const clickedNotification = event.notification; const clickedNotification = event.notification;
clickedNotification.close(); clickedNotification.close();
const data = clickedNotification.data || {};
if (event.action == "open" && event.data?.id) { if (event.action == "open" && data.id) {
const promiseChain = clients.openWindow( const promiseChain = clients.openWindow(
BASE_URL + "/colles/" + event.data.id BASE_URL + "/colles/" + data.id
); );
event.waitUntil(promiseChain); event.waitUntil(promiseChain);
} else { } else {