Im trying to fetch a endpoint from my Electron app with this code:
componentDidMount() {
fetch("https://xxxxxxxx.xxx/getCheckouts?licenseKey=XXX-XXX-XXX", {
mode: 'no-cors'
method: 'GET',
headers: {
"X-Api-Key": "XXXXXXXXXXX",
'content-type': 'application/json'
}
})
.then(res => res.json())
.then(data => {
console.log(data)
})
.catch((err)=>{
console.error(err)
})
}
and i receive this error in the console:
Access to fetch at 'https://xxxxxxx.xxx/getCheckouts?licenseKey=XXX-XXX-XXX' from origin 'http://localhost:3000' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
I cannot find a solution to this, any idea why this happen?