原文
fetch("http:/example.com", {method: "POST",
body: JSON.stringify(
{
uname: uname,
password: password
}
)
})
.then((response) => response.json())
.then((responseData) => {
AlertIOS.alert(
"POST Response",
"Response Body -> " + JSON.stringify(responseData.body)
)
}).done();
this.props.navigation.navigate("Home")
};
修改后的 response.text()
代替response.json()
fetch("http:/example.com", {method: "POST",
body: JSON.stringify(
{
uname: uname,
password: password
}
)
})
.then((response) => response.text())
.then((responseData) => {
AlertIOS.alert(
"POST Response",
"Response Body -> " + responseData
)
}).done();
this.props.navigation.navigate("Home")
};