Abh*_*kat 2 node.js reactjs react-native
我很反应原生,我已经编写了登录代码
payload={email:"niju1992@gmail.com",password:"helo123"};
var Options=
{
method: 'POST',
headers: {'Accept': 'application/json','Content-Type': 'application/json'},
body: payload
}
fetch(Conf.API.SIGNIN, Options)
.then((response) =>
{
if (response.status >= 400)
{
throw new Error("Bad response from server");
}
return response.json();
})
.then((responseData) =>
{
//this.setState({data:responseData})
console.log(responseData)
})
.catch((error) => {
console.error("Error:"+error);
})
.done();
Run Code Online (Sandbox Code Playgroud)
但我得到错误
index.android.bundle:19291错误:TypeError:无法读取未定义的属性'bodyUsed'
任何一位专家都可以.有人可以帮忙吗?
只是在这里明确,问题是输入URL fetch的值为undefined.
这可能导致如下异常:
TypeError: Cannot read property 'bodyUsed' of undefined at new Request
Run Code Online (Sandbox Code Playgroud)
确保fetch定义了第一个参数!
否则你会有一些神秘的错误导航.
| 归档时间: |
|
| 查看次数: |
960 次 |
| 最近记录: |