Fix missing ID generation for new news items and add IDs to existing entries
This commit is contained in:
@@ -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",
|
||||
|
||||
@@ -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()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user