TypeError: Network request failed
-尝试登录时遇到此错误,这是我使用的代码,谢谢您
constructor(props)
{
super(props)
this.state={email1:'',password1:''}
}
login = () =>
{
const {email1}=this.state;
const {password1}=this.state;
fetch('http://192.168.1.114',{
method: 'POST',
headers:{
'Accept': 'application/json',
'Content-Type':'application/json'
},
body: JSON.stringify({
email: 'email1',
password: 'password1'
})
})
.then((response)=>response.json())
.then((responseJson)=>{
alert(responseJson)
})
.catch((error)=>{
console.error(error);
});