diff --git a/src/components/company-form.tsx b/src/components/company-form.tsx index 39772a80..470724e4 100644 --- a/src/components/company-form.tsx +++ b/src/components/company-form.tsx @@ -76,7 +76,7 @@ export const CompanyForm = ({ setIsDialogOpen }: any) => { }; const handleFileChange = async (e: any) => { - const selectedFile = e.target.files[0]; + const selectedFile = e.target.files?.[0]; if (!selectedFile) return; // Basic file validation @@ -88,6 +88,8 @@ export const CompanyForm = ({ setIsDialogOpen }: any) => { }); } + setFile(selectedFile); + const reader = new FileReader(); reader.onload = () => { if (companyLogoImg.current) { @@ -95,8 +97,8 @@ export const CompanyForm = ({ setIsDialogOpen }: any) => { } setPreviewImg(reader.result as string); }; + reader.readAsDataURL(selectedFile); - setFile(selectedFile); }; const handleDescriptionChange = (fieldName: any, value: string) => { diff --git a/src/components/job-form.tsx b/src/components/job-form.tsx index c80a24af..8dd2e358 100644 --- a/src/components/job-form.tsx +++ b/src/components/job-form.tsx @@ -626,22 +626,35 @@ const PostJobForm = () => {

Company

- - - + ( + + + Select a Company* + + + + + + )} + /> +
OR{' '} diff --git a/src/lib/validators/jobs.validator.ts b/src/lib/validators/jobs.validator.ts index 19c0c294..81d95340 100644 --- a/src/lib/validators/jobs.validator.ts +++ b/src/lib/validators/jobs.validator.ts @@ -5,12 +5,6 @@ import { SortByEnums } from '../constant/jobs.constant'; export const JobPostSchema = z .object({ companyId: z.string().min(1, 'Company id is required'), - company: z.object({ - id: z.string().min(1, 'Company id is required'), - name: z.string().min(1, 'Company name is required'), - bio: z.string().min(1, 'Company bio is required'), - logo: z.string().min(1, 'Company logo is required'), - }), title: z.string().min(1, 'Title is required'), description: z.string().min(1, 'Description is required'), city: z.string().min(1, 'City Name is required'),