fix: resolve TypeScript errors for Zod v4 API changes
This commit is contained in:
@@ -60,7 +60,10 @@ export function ContactSection() {
|
|||||||
setErrors((prev) => ({ ...prev, [field]: undefined }));
|
setErrors((prev) => ({ ...prev, [field]: undefined }));
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (error instanceof z.ZodError) {
|
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) {
|
if (!result.success) {
|
||||||
const fieldErrors: FormErrors = {};
|
const fieldErrors: FormErrors = {};
|
||||||
result.error.errors.forEach((error) => {
|
result.error.issues.forEach((issue) => {
|
||||||
const field = error.path[0] as keyof ContactFormData;
|
const field = issue.path[0] as keyof ContactFormData;
|
||||||
fieldErrors[field] = error.message;
|
fieldErrors[field] = issue.message;
|
||||||
});
|
});
|
||||||
setErrors(fieldErrors);
|
setErrors(fieldErrors);
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ export function InsightsSection() {
|
|||||||
`}
|
`}
|
||||||
>
|
>
|
||||||
<Button
|
<Button
|
||||||
variant="outline"
|
variant="secondary"
|
||||||
size="lg"
|
size="lg"
|
||||||
className="group"
|
className="group"
|
||||||
onClick={() => window.location.href = '/insights'}
|
onClick={() => window.location.href = '/insights'}
|
||||||
|
|||||||
Reference in New Issue
Block a user