diff --git a/apps/admin/app/(pages)/brands/(components)/AddBrandForm.tsx b/apps/admin/app/(pages)/brands/(components)/AddBrandForm.tsx index 8db78a5..e369c31 100644 --- a/apps/admin/app/(pages)/brands/(components)/AddBrandForm.tsx +++ b/apps/admin/app/(pages)/brands/(components)/AddBrandForm.tsx @@ -19,6 +19,7 @@ import toast from 'react-hot-toast' import { IoMdAddCircle } from 'react-icons/io' import * as Yup from 'yup' +import { createSlug } from '@admin/app/(utils)/createSlug' import AddImagesSection from '../../(components)/AddImagesSection' import CustomEditor from '../../(components)/CustomEditor' import FieldFileUpload from '../../(components)/FieldFileUpload' @@ -73,7 +74,7 @@ const AddBrandForm = ({ values const newData = { - slug: title, + slug: createSlug(title), title, metadata: { title: seoTitle, diff --git a/apps/admin/app/(pages)/brands/(components)/EditBrandForm.tsx b/apps/admin/app/(pages)/brands/(components)/EditBrandForm.tsx index 674a3fa..96ce281 100644 --- a/apps/admin/app/(pages)/brands/(components)/EditBrandForm.tsx +++ b/apps/admin/app/(pages)/brands/(components)/EditBrandForm.tsx @@ -12,6 +12,7 @@ import { useState } from 'react' import toast from 'react-hot-toast' import * as Yup from 'yup' +import { createSlug } from '@admin/app/(utils)/createSlug' import AddImagesSection from '../../(components)/AddImagesSection' import CustomEditor from '../../(components)/CustomEditor' import FieldFileUpload from '../../(components)/FieldFileUpload' @@ -78,6 +79,7 @@ const EditBrandForm = ({ values const dataToUpdate = { ...brand.data, + slug: createSlug(title), title, metadata: { title: seoTitle, @@ -125,6 +127,7 @@ const EditBrandForm = ({ initialValues={{ file: null, title: brand.data.title, + slug: brand.data.slug, seoTitle: brand.data.metadata.title, seoDescription: brand.data.metadata.description, seoKeywords: brand.data.metadata.keywords, @@ -224,7 +227,26 @@ const EditBrandForm = ({ {props.values.file || selectedIcon ? '' : errorImage} -
+
+ + {({ meta, field }: any) => ( + + )} + {({ meta, field }: any) => (