feat: auto-persist state to localStorage on every change
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user