InsertDataToServer = () => {
const { pinValue1 } = this.state;
const { pinValue2 } = this.state;
const { pinValue3 } = this.state;
const { pinValue4 } = this.state;
var String_3 = pinValue1.concat(" " , pinValue2);
var String_4 = String_3.concat(" " , pinValue3);
var String_5 = String_4.concat(" " , pinValue4);
fetch("http://www.aonde.biz/mobile/doLogin.php", {
method: "POST",
headers: {
Accept: "application/json",
"Content-Type": "application/json"
},
body: JSON.stringify({
"pin":212,
})
})
.then(response => response.json())
.then(responseJson => {
// Showing response message coming from server after inserting records.
Alert.alert(responseJson);
})
.catch(error => {
console.error(error);
});
In the above code when I pass pin parameter API then show this error. Thank you please give some idea how to resolve this issue.
This error was fixed when code changed from:
Alert.alert('Error:', error)
to:
Alert.alert('Error:', error.message)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With