fix(seed-forms): add confirmationMessage to both form creates
Payload forms plugin requires a Lexical rich-text confirmationMessage when confirmationType is 'message'; omitting it caused a 500 on seed. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
b5c34f6f0b
commit
41593c8edc
1 changed files with 28 additions and 0 deletions
|
|
@ -12,6 +12,28 @@ export async function POST(req: NextRequest): Promise<NextResponse> {
|
|||
|
||||
const payload = await getPayload({ config })
|
||||
|
||||
const successMessage = (text: string) => ({
|
||||
root: {
|
||||
type: 'root',
|
||||
format: '',
|
||||
indent: 0,
|
||||
version: 1,
|
||||
direction: 'ltr' as const,
|
||||
children: [
|
||||
{
|
||||
type: 'paragraph',
|
||||
format: '',
|
||||
indent: 0,
|
||||
version: 1,
|
||||
direction: 'ltr' as const,
|
||||
children: [
|
||||
{ type: 'text', detail: 0, format: 0, mode: 'normal', style: '', text, version: 1 },
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
})
|
||||
|
||||
// Check idempotency per form separately
|
||||
const existingBirthday = await payload.find({
|
||||
collection: 'forms',
|
||||
|
|
@ -85,6 +107,9 @@ export async function POST(req: NextRequest): Promise<NextResponse> {
|
|||
],
|
||||
submitButtonLabel: 'Замовити святкування',
|
||||
confirmationType: 'message',
|
||||
confirmationMessage: successMessage(
|
||||
"Заявку отримано! Менеджер зв'яжеться з вами протягом 30 хвилин для уточнення деталей свята."
|
||||
),
|
||||
} as never,
|
||||
overrideAccess: true,
|
||||
}))
|
||||
|
|
@ -150,6 +175,9 @@ export async function POST(req: NextRequest): Promise<NextResponse> {
|
|||
],
|
||||
submitButtonLabel: 'Надіслати заявку',
|
||||
confirmationType: 'message',
|
||||
confirmationMessage: successMessage(
|
||||
'Заявку отримано! Менеджер зателефонує вам протягом 30 хвилин для уточнення деталей.'
|
||||
),
|
||||
} as never,
|
||||
overrideAccess: true,
|
||||
}))
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue