fix: notificationclick event
All checks were successful
Deploy to Netlify / Deploy to Netlify (push) Successful in 1m56s
All checks were successful
Deploy to Netlify / Deploy to Netlify (push) Successful in 1m56s
This commit is contained in:
parent
fbd7138af9
commit
21cb6a8b9f
1 changed files with 3 additions and 2 deletions
|
|
@ -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 {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue