2
我在JS这个功能:与返回变量react方法
export let findUser = (user, pass) => fetch(baseURL+'/api/Login',{
method: 'POST',
headers:{
'Accept': 'application/json',
'Content-Type': 'application/json',
},
body: JSON.stringify({
username:user,
password:pass,
})
})
.then((response) => response.json())
.then((res) => {
if(res.success === true){
return 'A';
}else{
alert(res.message);
}
}).
.done();
但是,当我把它的阵营是这样的:
var user = file.findUser(this.state.username,this.state.password);
我得到了不确定的变量用户的内容,怎么能我从第一个函数传递一个值并使其反应为原生的?