Skip to content

Job application tracker and AI-powered job search assistant. Helps job seekers manage their search journey with AI resume review, job matching, task logging, and application analytics, all while keeping your data private.

Fix contact info form validation

Khuram Niaz18648491dd3f
diff --git a/src/components/profile/AddContactInfo.tsx b/src/components/profile/AddContactInfo.tsx
index 190aa5a..631c96d 100644
--- a/src/components/profile/AddContactInfo.tsx
+++ b/src/components/profile/AddContactInfo.tsx
@@ -65,7 +65,7 @@ function AddContactInfo({
headline: contactInfoToEdit.headline,
email: contactInfoToEdit.email,
phone: contactInfoToEdit.phone,
- address: contactInfoToEdit.address,
+ address: contactInfoToEdit.address ?? undefined,
},
{ keepDefaultValues: true }
);
diff --git a/src/models/addContactInfoForm.schema.ts b/src/models/addContactInfoForm.schema.ts
index 58a9dda..42733b6 100644
--- a/src/models/addContactInfoForm.schema.ts
+++ b/src/models/addContactInfoForm.schema.ts
@@ -9,18 +9,30 @@ export const AddContactInfoFormSchema = z.object({
.string({
required_error: "First Name is required.",
})
- .min(1),
+ .min(2, {
+ message: "First name must be at least 2 characters.",
+ }),
lastName: z
.string({
required_error: "Last Name is required.",
})
- .min(1),
+ .min(2, {
+ message: "Last name must be at least 2 characters.",
+ }),
headline: z
.string({
required_error: "Headline is required.",
})
- .min(1),
- email: z.string().optional(),
- phone: z.string().optional(),
+ .min(2, {
+ message: "Headline must be at least 2 characters.",
+ }),
+ email: z
+ .string({
+ required_error: "Email is required!",
+ })
+ .email("Please enter a valid email!"),
+ phone: z.string({
+ required_error: "Phone is required!",
+ }),
address: z.string().optional(),
});