import { Button } from "@/components/ui/button";
import { Input } from "@/components/ui/input";
import { InputOTP, InputOTPGroup, InputOTPSlot } from "@/components/ui/input-otp";
import { REGEXP_ONLY_DIGITS_AND_CHARS } from "input-otp";
import { useState, useCallback } from "react";
import { toast } from "sonner";
import LoginHeader from "./LoginHeader";
import { Label } from "@/components/ui/label"
import { HumanVerification } from "@/components/human-verification";
import { AuthAPI, SmsAPI } from "@/lib/api/client";
import { handleAPIError } from "@/lib/api/common";
export default function SmsLoginMode() {
const [phone, setPhone] = useState("");
const handleSendCode = useCallback(async () => {
await SmsAPI.sendLoginSms(phone)
.then(() => toast.success('验证码已发送!'))
.catch(e => handleAPIError(e, ({ message }) => toast.error(`${message}`)))
}, [phone]);
return (
<>