fixed: force issues
This commit is contained in:
@@ -34,7 +34,7 @@ const useCreateCompanyPresenter = ({ defaultValues, editMode, id }: IProps) => {
|
||||
|
||||
useEffect(() => {
|
||||
if (defaultValues) {
|
||||
const categories = defaultValues?.tags.categories.map(
|
||||
const categories = defaultValues?.tags?.categories?.map(
|
||||
(item: any) => item.id,
|
||||
);
|
||||
setValue("tags.categories", categories);
|
||||
@@ -52,6 +52,19 @@ const useCreateCompanyPresenter = ({ defaultValues, editMode, id }: IProps) => {
|
||||
founded_year: data.founded_year ? +data.founded_year : 0,
|
||||
employee_count: data.employee_count ? +data.employee_count : 0,
|
||||
annual_revenue: data.annual_revenue ? +data.annual_revenue : 0,
|
||||
tags: {
|
||||
keywords: data?.tags?.keywords?.length ? data?.tags?.keywords : [],
|
||||
categories: data?.tags?.categories?.length
|
||||
? data?.tags?.categories
|
||||
: [],
|
||||
cpv_codes: data?.tags?.cpv_codes?.length ? data?.tags?.cpv_codes : [],
|
||||
specializations: data?.tags?.specializations?.length
|
||||
? data?.tags?.specializations
|
||||
: [],
|
||||
certifications: data?.tags?.certifications?.length
|
||||
? data?.tags?.certifications
|
||||
: [],
|
||||
},
|
||||
};
|
||||
if (editMode) {
|
||||
updateCompany({
|
||||
@@ -61,7 +74,9 @@ const useCreateCompanyPresenter = ({ defaultValues, editMode, id }: IProps) => {
|
||||
} else {
|
||||
createCompany(formattedData as ICreateCompanyCredentials);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
const handleCancel = () => {
|
||||
reset();
|
||||
router.back();
|
||||
|
||||
Reference in New Issue
Block a user