【发布时间】:2022-11-03 11:43:55
【问题描述】:
我想检查数据库中是否存在电子邮件。我写了这样的东西,但我不知道如何从 axios 传递结果。
email: yup
.string()
.email('type correct email')
.required('email is required')
.test(
'email check',
'email exists in the database',
async (value) => {
await AuthServices.checkEmailExist(value).then((response) => {
console.log(response.data)
})
}
如果电子邮件存在,我的 response.data 返回 true,如果电子邮件不在数据库中,则返回 false。如何判断响应是真还是假?
【问题讨论】:
标签: reactjs validation axios response yup