Automatically refresh the CAPTCHA after an error in the CAPTCHA input

clipboard.png

<FormItem>
    <Row gutter={10}>
      <Col span={16}>
        {getFieldDecorator("code", {
          //  rules: [{
          //    validator: (rule, value = "", callback) => {
          //      const text = captchaText;
          //      const upper = value.toUpperCase();
          //      if (upper !== text) callback("");
          //      callback();
          //    },
          //  }],
        })(<Input placeholder="" />)}
      </Col>
      <Col
        span={8}
        className={styles.captchaText}
        onClick={() => {
          this.handleGetCaptcha();
        }}
      >
        {<img src={captcha} alt="" />}
      </Col>
    </Row>
  </FormItem>
componentDidMount() {
    this.handleGetCaptcha();
}
handleGetCaptcha = captcha => {
    this.props.dispatch({
      type: "login/fetchCaptcha",
    });
    this.setState({
      captcha,
    });
};

now the input error of the CAPTCHA is judged by the backend after the data is submitted. If the login is not successful, how to automatically refresh the CAPTCHA
, using the lifecycle function? It is better to make judgments when requesting fetch in models .

Mar.11,2021

is written in the failed callback function of the login method, where the method of obtaining the CAPTCHA is executed again.


there is a problem with writing this way before. There is an extra one in the code. Thank you

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b34d5e-2bf40.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b34d5e-2bf40.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?