import { ModalForm, ProFormText } from '@ant-design/pro-components';
import { message } from 'antd';

export default function ForgotPasswordModal({
  open,
  onCancel,
}: {
  open: boolean;
  onCancel: () => void;
}) {
  return (
    <ModalForm
      open={open}
      wrapperCol={{ span: 24 }}
      width="500px"
      title="忘记密码"
      onFinish={async (values) => {
        // 在此处调用发送重置密码邮件或短信的API
        // Apis.Common.Auth.ForgotPassword(values).then(() => {
        //   message.success('重置密码邮件已发送，请查收');
        //   onCancel();
        // }).catch(() => false);
        message.success('模拟发送成功，请检查您的邮箱或手机');
        onCancel();
        return Promise.resolve(true);
      }}
      modalProps={{
        onCancel: onCancel,
      }}
    >
      <ProFormText name="email" label="注册邮箱" required />
      {/* 或者手机号 */}
      {/* <ProFormText name="phone" label="注册手机号" required /> */}
    </ModalForm>
  );
}
