diff --git a/apps/backoffice/src/app/features/profile/pages/ProfilePage.tsx b/apps/backoffice/src/app/features/profile/pages/ProfilePage.tsx index 1cffa5444..0a6afc228 100644 --- a/apps/backoffice/src/app/features/profile/pages/ProfilePage.tsx +++ b/apps/backoffice/src/app/features/profile/pages/ProfilePage.tsx @@ -31,7 +31,6 @@ import { IconLock, IconMail, IconMoon, - IconPhone, IconSettings, IconShieldLock, IconSun, @@ -42,7 +41,7 @@ import { useForm } from 'react-hook-form'; import { zodResolver } from '@hookform/resolvers/zod'; import { z } from 'zod'; import { useTranslation } from 'react-i18next'; -import { notify, PageHeader, useErrorHandler, passwordSchema as strongPasswordSchema, PasswordRequirements, phoneNumber } from '@ema-platform/ui'; +import { notify, PageHeader, useErrorHandler, passwordSchema as strongPasswordSchema, PasswordRequirements, phoneNumber, PhoneInput } from '@ema-platform/ui'; import { useApiMutation } from '@ema-platform/api'; import { ActiveSessions, setUser } from '@ema-platform/auth'; import type { AuthUser } from '@ema-platform/auth'; @@ -136,6 +135,9 @@ export function ProfilePage() { register: registerProfile, handleSubmit: handleProfileSubmit, reset: resetProfile, + watch: watchProfile, + setValue: setValueProfile, + trigger: triggerProfile, formState: { errors: profileErrors }, } = useForm({ resolver: zodResolver(profileSchema), @@ -372,11 +374,12 @@ export function ProfilePage() { error={profileErrors.email?.message} {...registerProfile('email')} /> - } + value={watchProfile('phoneNumber') || ''} + onChange={(val) => setValueProfile('phoneNumber', val, { shouldValidate: !!profileErrors.phoneNumber })} + onBlur={() => triggerProfile('phoneNumber')} error={profileErrors.phoneNumber?.message} - {...registerProfile('phoneNumber')} />