diff --git a/components/form/login.tsx b/components/form/login.tsx index 970dc75..009d146 100644 --- a/components/form/login.tsx +++ b/components/form/login.tsx @@ -71,13 +71,22 @@ export default function Login() { } else { // login dengan otp loading(); - const response = await emailValidation(data); + 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 {