fixed route Notification
All checks were successful
Build frontend / build (push) Successful in 1m33s
All checks were successful
Build frontend / build (push) Successful in 1m33s
This commit is contained in:
@ -31,10 +31,25 @@ messaging.onBackgroundMessage((payload) => {
|
||||
self.registration.showNotification(title, options);
|
||||
});
|
||||
|
||||
function mapNotificationUrl(url) {
|
||||
if (!url) return "/";
|
||||
if (url.startsWith("/SaleProperty/")) {
|
||||
return url.replace("/SaleProperty/", "/owner/properties/");
|
||||
}
|
||||
if (url.startsWith("/reservations/")) {
|
||||
return url.replace("/reservations/", "/reservations/");
|
||||
}
|
||||
if (url === "/" || url === "/home") {
|
||||
return "/";
|
||||
}
|
||||
return url;
|
||||
}
|
||||
|
||||
// Handle notification click
|
||||
//اذا ضغطنا ع الاشعار شو بصير
|
||||
self.addEventListener("notificationclick", (event) => {
|
||||
event.notification.close();
|
||||
const url = event.notification.data?.url || "/";
|
||||
const notificationUrl = event.notification.data?.url || "/";
|
||||
const url = mapNotificationUrl(notificationUrl);
|
||||
event.waitUntil(clients.openWindow(url));
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user