Discussions
CORS error while making API call
over 2 years ago by Mathes Kanagarajan
How do I whitelist my domain so the waitwhile server would not respond back with CORS error?
Code:
apikey: '<>',
apiUrl: 'https://api.waitwhile.com/v2/customers',
axios.post(this.apiUrl, data, {
headers: headers
})
.then((response) => {
console.log('Response - ');
console.log(response);
})
.catch((error) => {
console.log('Response Error - ');
console.log(error);
})
Error:
Access to XMLHttpRequest at 'https://api.waitwhile.com/v2/customers' from origin 'null' 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.