refactor: standarisasi antarmuka fungsi login dan pengambilan OTP
Mengubah parameter fungsi auth_funLogin dan auth_getKodeOtpById di backend untuk menggunakan objek, meningkatkan konsistensi dan memudahkan pemahaman tentang data yang diproses. Selain itu, memperbaiki struktur respons fungsi untuk menambahkan dalam output, memperjelas sumber terjadinya error. - Di , fungsi auth_funLogin diubah untuk menerima sebuah objek daripada hanya . - Di , perubahan variabel ke untuk menyelaraskan dengan parameter terbaru dari fungsi yang diinvokasi.
This commit is contained in:
@@ -34,16 +34,14 @@ export default function Login() {
|
||||
const [isError, setError] = useState(false);
|
||||
|
||||
async function onLogin() {
|
||||
const nomorHp = phone.substring(1);
|
||||
const nomor = phone.substring(1);
|
||||
if (nomor.length <= 4) return setError(true);
|
||||
|
||||
if (nomorHp.length <= 4) return setError(true);
|
||||
|
||||
const res = await auth_funLogin(nomorHp);
|
||||
const res = await auth_funLogin({ nomor: nomor });
|
||||
if (res.status === 200) {
|
||||
setLoading(true);
|
||||
ComponentGlobal_NotifikasiBerhasil(res.message, 2000);
|
||||
setKodeId(res.kodeOtpId);
|
||||
router.push(RouterAuth.validasi + res.kodeOtpId);
|
||||
router.push(RouterAuth.validasi + res.nomorUser, { scroll: false });
|
||||
} else {
|
||||
ComponentGlobal_NotifikasiPeringatan(res.message);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user