"use client"; import { RouterAuth } from "@/app/lib/router_hipmi/router_auth"; import { AccentColor, MainColor, } from "@/app_modules/_global/color/color_pallet"; import ComponentGlobal_ErrorInput from "@/app_modules/_global/component/error_input"; import { auth_funLogin } from "@/app_modules/auth/fun/fun_login"; import { BackgroundImage, Button, Center, Stack, Text, Title, } from "@mantine/core"; import { useAtom } from "jotai"; import { useRouter } from "next/navigation"; import { useState } from "react"; import { PhoneInput } from "react-international-phone"; import "react-international-phone/style.css"; import { gs_kodeId } from "../state/state"; import { ComponentGlobal_NotifikasiBerhasil, ComponentGlobal_NotifikasiPeringatan, } from "@/app_modules/_global/notif_global"; export default function Login() { const router = useRouter(); const [phone, setPhone] = useState(""); const [loading, setLoading] = useState(false); const [isError, setError] = useState(false); async function onLogin() { const nomor = phone.substring(1); if (nomor.length <= 4) return setError(true); const res = await auth_funLogin({ nomor: nomor }); if (res.status === 200) { setLoading(true); ComponentGlobal_NotifikasiBerhasil(res.message, 2000); router.push(RouterAuth.validasi + res.kodeId, { scroll: false }); } else { ComponentGlobal_NotifikasiPeringatan(res.message); } // await fetch(ApiHipmi.login, { // method: "POST", // headers: { // "Content-Type": "application/json", // }, // body: JSON.stringify(body), // }) } return ( <> WELCOME TO HIPMI APPS
Nomor telepon
{ setPhone(val); }} /> {isError ? ( ) : ( "" )}
); }