Rollen Freigaben Push und Beleg Upload ueberarbeiten
All checks were successful
CI / Build (push) Successful in 2m6s
CI / Deploy (push) Successful in 2m11s

This commit is contained in:
jan
2026-05-01 15:50:37 +02:00
parent f947908f0e
commit 549c8f16c6
34 changed files with 1354 additions and 172 deletions

View File

@@ -43,3 +43,37 @@ self.addEventListener("fetch", (event) => {
})
);
});
self.addEventListener("push", (event) => {
const payload = event.data?.json() ?? {};
const title = payload.title || "RFP Finanzen";
const options = {
body: payload.body || "Es gibt eine neue Benachrichtigung.",
icon: "/icon-192.png",
badge: "/icon-192.png",
tag: payload.tag || "rfp-finance",
data: {
url: payload.url || "/"
}
};
event.waitUntil(self.registration.showNotification(title, options));
});
self.addEventListener("notificationclick", (event) => {
event.notification.close();
const targetUrl = new URL(event.notification.data?.url || "/", self.location.origin).href;
event.waitUntil(
clients.matchAll({ type: "window", includeUncontrolled: true }).then((clientList) => {
for (const client of clientList) {
if ("focus" in client) {
client.navigate(targetUrl);
return client.focus();
}
}
return clients.openWindow(targetUrl);
})
);
});