I've tried many different approaches from what I've searched on here to try to solve the issue, but none of them have worked so far.
When I add no headers I get the following header:
However, when I do add them I get this error instead:
I've tried just adding the domain as proxy
in package.json
as I used create-react-app
, but no luck.
import axios from 'axios';
export default function getResponse(xappToken){
console.log(xappToken);
axios.get('https://api.artsy.net/api/v1/artists/popular', {
headers: {
'Access-Control-Allow-Origin': 'http://localhost:3000/',
'X-Access-Token': xappToken,
'Accept': 'application/json',
}
})
.then(function (response) {
console.log(response);
})
.catch(function (error) {
console.log(error);
})
.then(function () {
// always executed
});
}
API documentation: https://developers.artsy.net/v1/playground#/artists/getApiV1ArtistsPopular