Been searching all over for a solution to this problem:
Fetch API cannot load https://api.wunderground.com/api/******/conditions/q/toronto. The 'Access-Control-Allow-Origin' header has a value 'http://www.wunderground.com' that is not equal to the supplied origin. Origin 'http://localhost:3000' is therefore not allowed access. Have the server send the header with a valid value, or, if an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
const apiKey = '******'
const apiUrl = 'https://api.wunderground.com/api/' + apiKey + '/conditions/q/'
var WeatherApi = {
get: function(query) {
return fetch(apiUrl + query).then(function(response) {
return response.json();
});
}
};
handleClick: function() {
WeatherApi.get(this.state.text).then(function(data) {
console.log(data);
}.bind(this));
},
So how do I have the server send the header with a valid value?