1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-02-20 14:54:15 +01:00

(quality) simplified regex

This commit is contained in:
Sylvain 2022-10-03 17:26:43 +02:00
parent 7798df1f87
commit 31044a56ac
2 changed files with 3 additions and 2 deletions

View File

@ -77,7 +77,8 @@ export const ManageProductCategory: React.FC<ManageProductCategoryProps> = ({ pr
<ProductCategoryForm action={action}
productCategories={productCategories}
productCategory={productCategory}
onSuccess={handleSuccess} onError={onError} />
onSuccess={handleSuccess}
onError={onError} />
</FabModal>
</div>
);

View File

@ -62,7 +62,7 @@ export const ProductCategoryForm: React.FC<ProductCategoryFormProps> = ({ action
}, [watch]);
// Check slug pattern
// Only lowercase alphanumeric groups of characters separated by an hyphen
const slugPattern = /^[a-z0-9]+(?:-[a-z0-9]+)*$/g;
const slugPattern = /^[a-z\d]+(?:-[a-z\d]+)*$/g;
// Form submit
const onSubmit: SubmitHandler<ProductCategory> = (category: ProductCategory) => {