validate() {
let username = this.state.username;
let password = this.state.password;
let userPassCombination = username + ':' + password;
let encodedPass = base64.encode(userPassCombination);
let headers = {
'Content-Type': 'text/json',
Authorization: 'Basic ' + encodedPass,
};
fetch(myConstants.URL + '/wp-json/', {
method: 'GET',
headers: headers,
}).then(responseData => {
//console.log(JSON.stringify(responseData));
if (responseData.ok) {
this.props.navigation.navigate('Profile', {
username: this.state.username,
});
}
else {
alert('wrong information.');
}
});
}