mirror of
https://github.com/blakeblackshear/frigate.git
synced 2025-12-07 22:05:44 +03:00
Try and improve notification opening behavior
This commit is contained in:
parent
426699d3d0
commit
2d06055bbe
@ -44,11 +44,16 @@ self.addEventListener("notificationclick", (event) => {
|
|||||||
switch (event.action ?? "default") {
|
switch (event.action ?? "default") {
|
||||||
case "markReviewed":
|
case "markReviewed":
|
||||||
if (event.notification.data) {
|
if (event.notification.data) {
|
||||||
fetch("/api/reviews/viewed", {
|
event.waitUntil(
|
||||||
method: "POST",
|
fetch("/api/reviews/viewed", {
|
||||||
headers: { "Content-Type": "application/json", "X-CSRF-TOKEN": 1 },
|
method: "POST",
|
||||||
body: JSON.stringify({ ids: [event.notification.data.id] }),
|
headers: {
|
||||||
});
|
"Content-Type": "application/json",
|
||||||
|
"X-CSRF-TOKEN": 1,
|
||||||
|
},
|
||||||
|
body: JSON.stringify({ ids: [event.notification.data.id] }),
|
||||||
|
})
|
||||||
|
);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -58,7 +63,7 @@ self.addEventListener("notificationclick", (event) => {
|
|||||||
// eslint-disable-next-line no-undef
|
// eslint-disable-next-line no-undef
|
||||||
if (clients.openWindow) {
|
if (clients.openWindow) {
|
||||||
// eslint-disable-next-line no-undef
|
// eslint-disable-next-line no-undef
|
||||||
return clients.openWindow(url);
|
event.waitUntil(clients.openWindow(url));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user