Fix isPublic field not being saved when creating/editing news
This commit is contained in:
@@ -32,7 +32,7 @@ export default defineEventHandler(async (event) => {
|
||||
}
|
||||
|
||||
const body = await readBody(event)
|
||||
const { id, title, content } = body
|
||||
const { id, title, content, isPublic } = body
|
||||
|
||||
if (!title || !content) {
|
||||
throw createError({
|
||||
@@ -45,6 +45,7 @@ export default defineEventHandler(async (event) => {
|
||||
id: id || undefined,
|
||||
title,
|
||||
content,
|
||||
isPublic: isPublic || false,
|
||||
author: user.name
|
||||
})
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
"author": "Admin",
|
||||
"isPublic": false,
|
||||
"created": "2025-10-21T13:34:28.915Z",
|
||||
"updated": "2025-10-21T13:34:28.915Z"
|
||||
"updated": "2025-10-21T13:53:16.820Z"
|
||||
},
|
||||
{
|
||||
"id": "660e8400-e29b-41d4-a716-446655440002",
|
||||
|
||||
Reference in New Issue
Block a user