Fix missing ID generation for new news items and add IDs to existing entries

This commit is contained in:
Torsten Schulz (local)
2025-10-21 15:12:21 +02:00
parent ed2d184d5c
commit 3fe1c8adc0
15 changed files with 135 additions and 124 deletions

View File

@@ -1,5 +1,6 @@
[
{
"id": "n1729515536050",
"title": "aaa",
"content": "bbb",
"author": "Admin",
@@ -7,6 +8,7 @@
"updated": "2025-10-21T13:08:56.050Z"
},
{
"id": "n1729514969710",
"title": "Alles neu",
"content": "Die seite ist brandneu",
"author": "Admin",

View File

@@ -66,8 +66,8 @@ export async function saveNews(newsData) {
} else {
// Add new
const newItem = {
id: `n${Date.now()}`,
...newsData,
id: `n${Date.now()}`, // ID must come AFTER ...newsData to not be overwritten
created: new Date().toISOString(),
updated: new Date().toISOString()
}