insertdata = () => {
const { pinValue1 } = this.state;
const { pinValue2 } = this.state;
const { pinValue3 } = this.state;
const { pinValue4 } = this.state;
const { pinValue5 } = this.state;
const { pinValue6 } = this.state;
var String_3 = pinValue1.concat(pinValue2);
var String_4 = String_3.concat(pinValue3);
var String_5 = String_4.concat(pinValue4);
var String_6 = String_5.concat(pinValue5);
var final_string = String_6.concat(pinValue6);
console.log(final_string);
const { email } = this.state;
console.log(email);
fetch("http://demo.theoneinfotech.com/dating/user/user_invite_code", {
method: "POST",
headers: {
Accept: "application/json",
"Content-Type": "application/json"
},
body: JSON.stringify({
invite_code: final_string
})
})
.then(response => response.json())
.then(responseJson => {
// Showing response message coming from server after inserting records.
console.log(responseJson);
if ((responseJson.errorCode !=1)) {
// Alert.alert("pass sent on your email");
this.props.navigation.navigate("Signup");
//this.props.navigation.navigate("Referal")
} else {
Alert.alert("Invalid invite code");
}
//this.props.navigation.navigate("Forgot");
/*if (responseJson.data[0].nick_name!= null && responseJson.data[0].nick_name != "") {
this.props.navigation.navigate("Forgot");
} else {
Alert.alert("invalid pin number");
}*/
// Alert.alert(responseJson.message);
})
.catch(error => {
console.error(error);
});
};
<TouchableOpacity onPress={this.insertdata}>
<Text
style={{
textAlign: "center",
color: "white",
fontSize: 16,
opacity: 5
}}
>
VERIFY
</Text>
</TouchableOpacity>
在上面的代码中,我提到了调用 API 的 Insertdata 函数和调用 API 的事件。在我的情况下,当我在模拟器上运行代码然后显示上述错误但不在真实设备上。我第一次遇到这种类型的问题,请帮助我解决这个问题。