-
Notifications
You must be signed in to change notification settings - Fork 10
Open
Labels
Description
Hi! I have a question about making requests from frontend part. As i figured out https://www.tickspot.com/api doesn't return a 'Access-Control-Allow-Origin' header. API working fine if i send CURL request from terminal or use the backend. I want to implement ui on my frontend to be able make requests to API without backend, can you help me please with that question? Thanks!
Here is my code:
fetch('https://www.tickspot.com/api/v2/roles', {
method: 'GET',
headers: {
'Access-Control-Allow-Origin': '*',
'Content-type': 'application/json',
'Authorization': 'Basic mytoken',
'User-Agent': 'MyCoolApp (myemail)'
}
})
.then(res => {
if (res.ok)
return res.json();
throw new Error('An error has occured: ', res);
})
.catch(err => {
console.warn(err);
});