diff --git a/src/components/sections/contact-section.tsx b/src/components/sections/contact-section.tsx index 580da36..82ed505 100644 --- a/src/components/sections/contact-section.tsx +++ b/src/components/sections/contact-section.tsx @@ -60,7 +60,10 @@ export function ContactSection() { setErrors((prev) => ({ ...prev, [field]: undefined })); } catch (error) { if (error instanceof z.ZodError) { - setErrors((prev) => ({ ...prev, [field]: error.errors[0].message })); + const fieldError = error.issues[0]; + if (fieldError) { + setErrors((prev) => ({ ...prev, [field]: fieldError.message })); + } } } }; @@ -83,9 +86,9 @@ export function ContactSection() { if (!result.success) { const fieldErrors: FormErrors = {}; - result.error.errors.forEach((error) => { - const field = error.path[0] as keyof ContactFormData; - fieldErrors[field] = error.message; + result.error.issues.forEach((issue) => { + const field = issue.path[0] as keyof ContactFormData; + fieldErrors[field] = issue.message; }); setErrors(fieldErrors); return; diff --git a/src/components/sections/insights-section.tsx b/src/components/sections/insights-section.tsx index d59662c..a2cca1c 100644 --- a/src/components/sections/insights-section.tsx +++ b/src/components/sections/insights-section.tsx @@ -114,7 +114,7 @@ export function InsightsSection() { `} >