signIn = () => {
//post data to express backend
fetch('http://......./api/v1/auth', {
method: 'POST',
header: {
'Accept': 'application/json',
'Content-Type': 'application/json'
},
body: `login=${this.state.login}&password=${this.state.password}`
})
.then((response) => response.json())
.then((res) => {
if (res.success === true) {
this.props.navigation.navigate('Authorized')
} else {
alert(res)
}
})
.done();
}
I am continuously receiving such error and also network failed error when using localhost:3000
htmlinstead of JSON. Could you inspect the error code you got?responseand check what is content type...