From be17c43499c262fa5f5c1fa67be55cd299b99076 Mon Sep 17 00:00:00 2001 From: vinix Date: Sun, 12 Oct 2025 18:33:14 +0700 Subject: [PATCH] refactor update field user_prefix --- src/pages/auth/Signup.jsx | 37 ++++++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/src/pages/auth/Signup.jsx b/src/pages/auth/Signup.jsx index 123cbe7..8c72052 100644 --- a/src/pages/auth/Signup.jsx +++ b/src/pages/auth/Signup.jsx @@ -18,10 +18,11 @@ const SignUp = () => { }; const handleSignUp = async (values) => { - const { fullname, name, email, phone, password, confirmPassword } = values; + const { user_fullname, user_name, user_email, user_phone, user_password, confirmPassword } = + values; // Validasi confirm password - if (password !== confirmPassword) { + if (user_password !== confirmPassword) { NotifAlert({ icon: 'error', title: 'Password Tidak Sama', @@ -33,22 +34,22 @@ const SignUp = () => { // Validasi nomor telepon Indonesia const phoneRegex = /^(?:\+62|62|0)8[1-9][0-9]{6,11}$/; - if (!phoneRegex.test(phone)) { + if (!phoneRegex.test(user_phone)) { NotifAlert({ icon: 'error', title: 'Format Telepon Salah', message: 'Nomor telepon tidak valid (harus nomor Indonesia)', }); - form.resetFields(['phone']); + form.resetFields(['user_phone']); return; } // Validasi password kompleks const passwordErrors = []; - if (password.length < 8) passwordErrors.push('Minimal 8 karakter'); - if (!/[A-Z]/.test(password)) passwordErrors.push('Harus ada huruf kapital'); - if (!/[0-9]/.test(password)) passwordErrors.push('Harus ada angka'); - if (!/[!@#$%^&*(),.?":{}|<>]/.test(password)) + if (user_password.length < 8) passwordErrors.push('Minimal 8 karakter'); + if (!/[A-Z]/.test(user_password)) passwordErrors.push('Harus ada huruf kapital'); + if (!/[0-9]/.test(user_password)) passwordErrors.push('Harus ada angka'); + if (!/[!@#$%^&*(),.?":{}|<>]/.test(user_password)) passwordErrors.push('Harus ada karakter spesial'); if (passwordErrors.length) { NotifAlert({ @@ -56,13 +57,19 @@ const SignUp = () => { title: 'Password Tidak Valid', message: passwordErrors.join(', '), }); - form.resetFields(['password', 'confirmPassword']); + form.resetFields(['user_password', 'confirmPassword']); return; } setLoading(true); try { - const res = await register({ fullname, name, email, phone, password }); + const res = await register({ + user_fullname, + user_name, + user_email, + user_phone, + user_password, + }); NotifOk({ icon: 'success', @@ -121,14 +128,14 @@ const SignUp = () => { - + @@ -138,7 +145,7 @@ const SignUp = () => { { - + - +