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);
我得到了不確定的變量用戶的內容,怎麼能我從第一個函數傳遞一個值並使其反應爲原生的?