From 31f22068a8dffebf1d0d586f9a80a9f8ca3a5998 Mon Sep 17 00:00:00 2001 From: yassinedorbozgithub Date: Sun, 25 May 2025 23:03:27 +0100 Subject: [PATCH] fix(frontend): update useValidationRules hook --- ...eValidationRules.tsx => useValidationRules.ts} | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) rename frontend/src/hooks/{useValidationRules.tsx => useValidationRules.ts} (84%) diff --git a/frontend/src/hooks/useValidationRules.tsx b/frontend/src/hooks/useValidationRules.ts similarity index 84% rename from frontend/src/hooks/useValidationRules.tsx rename to frontend/src/hooks/useValidationRules.ts index 6dd06e6d..6a627c02 100644 --- a/frontend/src/hooks/useValidationRules.tsx +++ b/frontend/src/hooks/useValidationRules.ts @@ -1,25 +1,26 @@ /* - * Copyright © 2024 Hexastack. All rights reserved. + * Copyright © 2025 Hexastack. All rights reserved. * * Licensed under the GNU Affero General Public License v3.0 (AGPLv3) with the following additional terms: * 1. The name "Hexabot" is a trademark of Hexastack. You may not use this name in derivative works without express written permission. * 2. All derivative works must include clear attribution to the original creator and software, Hexastack and Hexabot, in a prominent location (e.g., in the software's "About" section, documentation, and README file). */ +import { FieldValues } from "react-hook-form"; + import { useTranslate } from "@/hooks/useTranslate"; +import { TRegisterOption } from "./useForm"; + export const useValidationRules = () => { const { t } = useTranslate(); - const validationRules = { - first_name: {}, - last_name: {}, + const rules = { email: { pattern: { value: /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i, message: t("message.email_is_invalid"), }, }, - language: {}, password: { minLength: { value: 8, @@ -41,7 +42,7 @@ export const useValidationRules = () => { message: t("message.url_is_invalid"), }, }, - }; + } satisfies Partial>; - return validationRules; + return rules; };