diff --git a/components/form/login.tsx b/components/form/login.tsx index bd1735d..12dfd58 100644 --- a/components/form/login.tsx +++ b/components/form/login.tsx @@ -69,12 +69,23 @@ export default function Login() { error("Username & Password Wajib Diisi !"); } else { // login dengan otp - const response = await emailValidation(data); + loading(); + const response: any = await emailValidation(data); if (response?.error) { - error("Username / Password Tidak Sesuai"); + console.log("error", response); + if (response?.message?.messages[0]?.includes("failed to send mail")) { + error("Gagal Mengirim OTP"); + return false; + } + + if (response?.message?.messages[0]?.includes("username")) { + error("Username / Password Tidak Sesuai"); + return false; + } + error("Unknown Error"); return false; } - + close(); if (response?.data?.messages[0] === "Continue to setup email") { setFirstLogin(true); } else {