Refactor logging implementation and enhance authentication logging
This commit is contained in:
@@ -2,31 +2,36 @@ import { checkSession, login, logout } from './auth.js';
|
||||
import { saveTask } from './tasks.js';
|
||||
import { saveTags, loadTags } from './tags.js';
|
||||
|
||||
navigator.serviceWorker.register('/service-worker.js')
|
||||
.then(registration => {
|
||||
console.log('ServiceWorker registration successful with scope: ', registration.scope);
|
||||
if ('serviceWorker' in navigator) {
|
||||
window.addEventListener('load', () => {
|
||||
navigator.serviceWorker.register('/service-worker.js')
|
||||
.then(registration => {
|
||||
console.log('ServiceWorker registration successful with scope: ', registration.scope);
|
||||
|
||||
registration.onupdatefound = () => {
|
||||
const installingWorker = registration.installing;
|
||||
installingWorker.onstatechange = () => {
|
||||
if (installingWorker.state === 'installed') {
|
||||
if (navigator.serviceWorker.controller) {
|
||||
// New update available
|
||||
console.log('New content is available; please refresh.');
|
||||
if (confirm('New version available. Do you want to update?')) {
|
||||
window.location.reload();
|
||||
registration.onupdatefound = () => {
|
||||
const installingWorker = registration.installing;
|
||||
installingWorker.onstatechange = () => {
|
||||
if (installingWorker.state === 'installed') {
|
||||
if (navigator.serviceWorker.controller) {
|
||||
// New update available
|
||||
console.log('New content is available; please refresh.');
|
||||
if (confirm('New version available. Do you want to update?')) {
|
||||
window.location.reload();
|
||||
}
|
||||
} else {
|
||||
// Content is cached for offline use
|
||||
console.log('Content is cached for offline use.');
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Content is cached for offline use
|
||||
console.log('Content is cached for offline use.');
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
})
|
||||
.catch(error => {
|
||||
console.log('ServiceWorker registration failed: ', error);
|
||||
});
|
||||
};
|
||||
};
|
||||
})
|
||||
.catch(error => {
|
||||
console.log('ServiceWorker registration failed: ', error);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
const loginForm = document.getElementById('loginForm');
|
||||
|
||||
Reference in New Issue
Block a user