fix: include generated id in createComment POST body
The book_comments collection has a custom 'id' field (type: text, required: true) distinct from PocketBase's system record ID. Every comment POST was returning 400 validation_required because the id field was never sent. Fix: generate a 15-char hex ID via crypto.randomUUID() and include it in the payload, matching PocketBase's own ID alphabet.
This commit is contained in:
@@ -1530,6 +1530,7 @@ export async function createComment(
|
||||
method: 'POST',
|
||||
headers: { Authorization: `Bearer ${token}`, 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({
|
||||
id: crypto.randomUUID().replace(/-/g, '').slice(0, 15),
|
||||
slug,
|
||||
chapter,
|
||||
body,
|
||||
|
||||
Reference in New Issue
Block a user