REFACTOR data service

This commit is contained in:
Urtzi Alfaro
2025-08-12 18:17:30 +02:00
parent 7c237c0acc
commit fbe7470ad9
149 changed files with 8528 additions and 7393 deletions

View File

@@ -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