I always have a lot of trouble with fetch() because I look at documentation and examples and it looks like I am doing it right but it still doesn't work.
I am trying to do fetch here but it just comes out as "[object Response]"
I don't know what that is actually? On Postman the same query returns a JSON object just fine and this looks to me just like the fetch examples so really not sure what I am doing wrong.
try {
let response = await fetch(
`https://us-central....`,
{
method: 'post',
mode: 'no-cors',
body: JSON.stringify(customer)
}
)
let data = await response.text()
console.log(`Response: ${data}`)
console.log(`Response: ${response}`)
} catch (e) {
console.error('Response Error: ', e)
return e
}
Actually I understand it is supposed to work with let data = await response.json()
but this gives me an error saying there is no JSON