feat: add open action
All checks were successful
Deploy to Netlify / Deploy to Netlify (push) Successful in 2m10s
All checks were successful
Deploy to Netlify / Deploy to Netlify (push) Successful in 2m10s
This commit is contained in:
parent
7ccd36a7c4
commit
b9773de805
1 changed files with 17 additions and 1 deletions
|
|
@ -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);
|
||||||
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue