Restructure with Turborepo
Run Tests on Branches / Backend Tests (push) Successful in 3m38s
Run Tests on Branches / Frontend Tests (push) Successful in 3m28s

This commit is contained in:
Antoni Nuñez Romeu
2026-07-06 15:51:53 +02:00
parent f66cafbbc3
commit 190b3d163d
277 changed files with 53253 additions and 0 deletions
+47
View File
@@ -0,0 +1,47 @@
/// <reference lib="webworker" />
import { precacheAndRoute, cleanupOutdatedCaches } from 'workbox-precaching';
import { clientsClaim } from 'workbox-core';
cleanupOutdatedCaches();
precacheAndRoute(self.__WB_MANIFEST || []);
self.skipWaiting();
clientsClaim();
self.addEventListener('push', (event) => {
let data = {};
if (event.data) {
try {
data = event.data.json();
} catch {
data = { title: 'FarmaClic', body: event.data.text() };
}
}
const title = data.title || 'FarmaClic';
const options = {
body: data.body || '',
icon: '/icon.svg',
badge: '/icon.svg',
data: { url: data.url || '/' },
tag: data.medicine_nregistro || undefined,
renotify: Boolean(data.medicine_nregistro),
};
event.waitUntil(self.registration.showNotification(title, options));
});
self.addEventListener('notificationclick', (event) => {
event.notification.close();
const targetUrl = event.notification.data?.url || '/';
event.waitUntil(
self.clients.matchAll({ type: 'window', includeUncontrolled: true }).then((clientList) => {
for (const client of clientList) {
if ('focus' in client) {
client.focus();
if ('navigate' in client) client.navigate(targetUrl);
return;
}
}
if (self.clients.openWindow) return self.clients.openWindow(targetUrl);
})
);
});