vor ähnlichkeitsprüfung

This commit is contained in:
2025-12-21 14:21:55 +01:00
parent ffcfce2b31
commit fde5ab91c8
14 changed files with 721 additions and 50 deletions

View File

@@ -96,6 +96,18 @@
let sse = null;
let relativeTimer = null;
function handleUnauthorized(response) {
if (response && response.status === 401) {
if (typeof redirectToLogin === 'function') {
redirectToLogin();
} else {
window.location.href = 'login.html';
}
return true;
}
return false;
}
function toDateTimeLocal(value) {
if (!value) return '';
const date = value instanceof Date ? value : new Date(value);
@@ -120,6 +132,9 @@
...(options.headers || {})
};
const response = await fetch(`${API_URL}${path}`, opts);
if (handleUnauthorized(response)) {
throw new Error('Nicht angemeldet');
}
if (!response.ok) {
let message = 'Unbekannter Fehler';
try {
@@ -1335,4 +1350,9 @@
activate,
deactivate: cleanup
};
const automationSection = document.querySelector('[data-view="automation"]');
if (automationSection && automationSection.classList.contains('app-view--active')) {
activate();
}
})();