我刚刚加入的项目没有使用后端的 API,而是必须通过 Axios-mock-adapter 自己创建模拟数据。我正在做一个修改密码的表格,如果输入正确,提交就会显示成功,如果输入不正确,则会显示错误(例如输入不为空,密码不匹配... ) 怎么做?
.onPost("/user/changepassword"), {
// How can I pass the values of the inputs
})
.reply(() => {
// How can I check the value of the inputs: empty, password input does not match...
if (conditions are ok) {
return [200, MOCK_RESPONSE.SUCCESS];
} else {
return [200, MOCK_RESPONSE.ERROR];
}
});