feat: add open action
All checks were successful
Deploy to Netlify / Deploy to Netlify (push) Successful in 2m10s

This commit is contained in:
Nathan Lamy 2025-08-21 11:36:37 +02:00
parent 7ccd36a7c4
commit b9773de805

View file

@ -17,4 +17,20 @@ async function onPush(event) {
}
}
// self.addEventListener("notificationclick", function (event) {});
const BASE_URL = "https://khollise.fr";
self.addEventListener("notificationclick", function (event) {
const clickedNotification = event.notification;
clickedNotification.close();
if (event.action == "open" && event.data.id) {
const promiseChain = clients.openWindow(
BASE_URL + "/colles/" + event.data.id
);
event.waitUntil(promiseChain);
return;
}
const promiseChain = clients.openWindow(BASE_URL);
event.waitUntil(promiseChain);
});