feat: push notifications

Signed-off-by: Omar Sánchez Pizarro <omar.sanchez@pistacero.net>
This commit is contained in:
Omar Sánchez Pizarro
2026-01-19 23:27:02 +01:00
parent ed4062b350
commit 9a61f16959
8 changed files with 683 additions and 9 deletions

View File

@@ -25,3 +25,17 @@ const app = createApp(App);
app.use(router);
app.mount('#app');
// Registrar Service Worker automáticamente al cargar la app
if ('serviceWorker' in navigator) {
window.addEventListener('load', async () => {
try {
const registration = await navigator.serviceWorker.register('/sw.js', {
scope: '/'
});
console.log('Service Worker registrado:', registration.scope);
} catch (error) {
console.error('Error registrando Service Worker:', error);
}
});
}