I am sending the following post request to the server
async function onPressLogin (state) {
const data = {username:state.email,password:state.password}
console.log('data at Json: ',JSON.stringify(data))
try {
let response = await fetch("http://localhost:5000/api/login",{
mode: "no-cors",
method:"POST",
body:JSON.stringify(data),
headers:{
"Content-Type": "application/json",
}
})
let result = await response.json()
console.log('Result: ',result)
} catch (e) {
console.log('Catch:',e.message)
}
}
But on the server request.body
is {}
What can be the issue here?