fix(seed-forms): add confirmationMessage to both form creates
Some checks are pending
CI / Type Check (push) Waiting to run
CI / Lint (push) Waiting to run
CI / Unit Tests (push) Waiting to run
Deploy / Build & Push Image (push) Waiting to run
Deploy / Deploy to VPS (push) Blocked by required conditions

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:
Vadym Samoilenko 2026-06-03 14:02:28 +01:00
parent b5c34f6f0b
commit 41593c8edc

View file

@ -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,
}))