I have one API made in PHP, but i want consume with Reactjs using fetch, but i can not get, someone can help me?
handleSubmit = event => {
event.preventDefault();
const email = document.querySelector(".email").value;
const senha = document.querySelector(".password").value;
alert(JSON.stringify({email, senha}));
const res = {
method: 'POST',
mode:'no-cors',
body: JSON.stringify({email,senha}),
headers: new Headers({
'Content-type': 'application/json',
'Authorization': 'token here',
}),
};
fetch('http://rhvagas-api/login', res).then(res => {})
.then(result => {
console.log(res);
return result.json();
})
}