I am trying to create a component in ReactJS that converts the money in my website from USD to other currencies. I am trying to use an axios call to third party API, ipapi.co
, that gives me the client's IP address and their country code and currency.
I'm getting CORS error in the browser:
Access to XMLHttpRequest at 'https://ipapi.co/json' from origin 'mywebsite.com' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
I can't apply server side proxy because I need the location of my client's computer for the feature to work completely.
Can you help me remove this error?
My code:
export const geoData =()=>{
return axios.get('https://ipapi.co/json/');
}