my react app does not fetch data becuse of CORS error:
1 of my examples
getOne: async (resource, params) => {
const url = `${apiUrl}/${resource}/${params.id}`
return fetch(url, {
method: 'GET',
headers: {'Access-Control-Allow-Origin': '*'}
})
.then(data => data.json())
.then(response => {
// console.log(response);
return { data: response}})
// .then(data => console.log(data))
.catch(err => console.error(err));
},
help me