feat: auto-persist state to localStorage on every change

This commit is contained in:
Ferdinand committed 2026-04-08 14:17:24 +02:00
1 parent 6ecf3e4409
commit dca82fe381
4 files changed
+47 -7

No files matched your search

+3 -1
View File
@@ -1,4 +1,4 @@
import { state } from './app.js';
import { state, saveState } from './app.js';
import { loadFromJSON, saveToJSON, removeHistoryEntry } from './data.js';
import { downloadBlob } from './excel.js';
@@ -79,6 +79,7 @@ export function renderDataTab() {
state.employees = loaded.employees;
state.calendar = loaded.calendar;
state.history = loaded.history;
saveState();
alert('Daten erfolgreich geladen.');
renderDataTab();
} catch (err) {
@@ -136,6 +137,7 @@ function renderHistoryTable() {
delBtn.style.cssText = 'font-size:11px;padding:2px 6px';
delBtn.addEventListener('click', () => {
removeHistoryEntry(state, h.date);
saveState();
renderHistoryTable();
});
actionTd.appendChild(delBtn);