首页 > 解决方案 > 通知用户该电子邮件已经存在。?

问题描述

社区,我正在开发一个用户应用程序,您可以注册和登录,我使用 React、RDX、SQL 和 UNIQUE: TRUE 属性。为避免重复发送邮件,DDBB 中不接受邮件,但浏览器屏幕上不会打印邮件已注册的通知。我不知道我是否跳过了一个步骤或正则表达式在我的代码中的位置错误我将我的代码留在了邮件正则表达式的位置。提前感谢您的帮助!

const [, setError] = useState([]);

axios
  .post("http://localhost:3006/users", body)
  .then((res) => {
    setDatosUser(res.data.results);
    })
    .catch((err) => {
      var errorText = err.response.data.message;
        if (errorText?.includes("email")){
              setError(JSON.stringify("El email ya esta registrado."));

        } else if (errorText?.includes("phone")){
              setError(JSON.stringify("El telefono ya esta registrado."));
        }else{
              setError(JSON.stringify(err.response.data.message));
        }
          return Error("Files not Found");
        });
          history.push("/login");```



标签: javascriptreactjs

解决方案


推荐阅读