REFACTOR data service
This commit is contained in:
@@ -58,6 +58,16 @@ interface RegisterForm {
|
||||
paymentCompleted: boolean;
|
||||
}
|
||||
|
||||
interface RegisterFormErrors {
|
||||
fullName?: string;
|
||||
email?: string;
|
||||
confirmEmail?: string;
|
||||
password?: string;
|
||||
confirmPassword?: string;
|
||||
acceptTerms?: string;
|
||||
paymentCompleted?: string;
|
||||
}
|
||||
|
||||
const RegisterPage: React.FC<RegisterPageProps> = ({ onLogin, onNavigateToLogin }) => {
|
||||
const { register, isLoading } = useAuth();
|
||||
|
||||
@@ -73,7 +83,7 @@ const RegisterPage: React.FC<RegisterPageProps> = ({ onLogin, onNavigateToLogin
|
||||
|
||||
const [showPassword, setShowPassword] = useState(false);
|
||||
const [showConfirmPassword, setShowConfirmPassword] = useState(false);
|
||||
const [errors, setErrors] = useState<Partial<RegisterForm>>({});
|
||||
const [errors, setErrors] = useState<RegisterFormErrors>({});
|
||||
const [passwordStrength, setPasswordStrength] = useState<{
|
||||
score: number;
|
||||
checks: { [key: string]: boolean };
|
||||
@@ -246,7 +256,7 @@ const RegisterPage: React.FC<RegisterPageProps> = ({ onLogin, onNavigateToLogin
|
||||
e.preventDefault();
|
||||
|
||||
// Validate form but exclude payment requirement for first step
|
||||
const newErrors: Partial<RegisterForm> = {};
|
||||
const newErrors: RegisterFormErrors = {};
|
||||
|
||||
if (!formData.fullName.trim()) {
|
||||
newErrors.fullName = 'El nombre completo es obligatorio';
|
||||
@@ -346,7 +356,7 @@ const RegisterPage: React.FC<RegisterPageProps> = ({ onLogin, onNavigateToLogin
|
||||
}));
|
||||
|
||||
// Clear error when user starts typing
|
||||
if (errors[name as keyof RegisterForm]) {
|
||||
if (errors[name as keyof RegisterFormErrors]) {
|
||||
setErrors(prev => ({
|
||||
...prev,
|
||||
[name]: undefined
|
||||
|
||||
Reference in New Issue
Block a user