mirror of
https://github.com/trevor1969/teatracker.git
synced 2026-08-09 10:41:59 +00:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 733e2db3c4 |
24
app.js
24
app.js
@ -778,6 +778,30 @@ class TeeTracker {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Load existing data from localStorage before switching to Nextcloud
|
||||||
|
// This prevents data loss when connecting to Nextcloud for the first time
|
||||||
|
const existingTeas = localStorage.getItem(STORAGE_KEY_TEAS);
|
||||||
|
const existingEntries = localStorage.getItem(STORAGE_KEY_ENTRIES);
|
||||||
|
|
||||||
|
if (existingTeas) {
|
||||||
|
try {
|
||||||
|
this.teas = JSON.parse(existingTeas).map(tea => ({
|
||||||
|
...tea,
|
||||||
|
organic: tea.organic !== undefined ? tea.organic : false
|
||||||
|
}));
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Error loading existing teas:', error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (existingEntries) {
|
||||||
|
try {
|
||||||
|
this.entries = JSON.parse(existingEntries);
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Error loading existing entries:', error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Save config WITHOUT password for security
|
// Save config WITHOUT password for security
|
||||||
// Password will be requested each time or stored in sessionStorage
|
// Password will be requested each time or stored in sessionStorage
|
||||||
const config = { baseUrl: url, username, path };
|
const config = { baseUrl: url, username, path };
|
||||||
|
|||||||
Reference in New Issue
Block a user