From 41593c8edcb73092cf4789a21d5e5d1d244d5bef Mon Sep 17 00:00:00 2001 From: Vadym Samoilenko Date: Wed, 3 Jun 2026 14:02:28 +0100 Subject: [PATCH] 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 --- src/app/api/admin/seed-forms/route.ts | 28 +++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/app/api/admin/seed-forms/route.ts b/src/app/api/admin/seed-forms/route.ts index 7787613..5470e47 100644 --- a/src/app/api/admin/seed-forms/route.ts +++ b/src/app/api/admin/seed-forms/route.ts @@ -12,6 +12,28 @@ export async function POST(req: NextRequest): Promise { 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 { ], submitButtonLabel: 'Замовити святкування', confirmationType: 'message', + confirmationMessage: successMessage( + "Заявку отримано! Менеджер зв'яжеться з вами протягом 30 хвилин для уточнення деталей свята." + ), } as never, overrideAccess: true, })) @@ -150,6 +175,9 @@ export async function POST(req: NextRequest): Promise { ], submitButtonLabel: 'Надіслати заявку', confirmationType: 'message', + confirmationMessage: successMessage( + 'Заявку отримано! Менеджер зателефонує вам протягом 30 хвилин для уточнення деталей.' + ), } as never, overrideAccess: true, }))