I am trying to use the google places API and use fetch but it has stopped working. I have done projects before that use the same stuff and work but this one just doesn’t want to work for some reason
Note: I am not adding my actual api key at the end
fetch("https://maps.googleapis.com/maps/api/place/details/json?placeid=ChIJN1t_tDeuEmsRUsoyG83frY4&fields=name,rating,formatted_phone_number&key=MY_API_KEY"
, { "method": "get" })
.then((httpResponse) => {
if (httpResponse.ok) {
console.log(httpResponse.json());
return httpResponse.json();
} else {
return Promise.reject("Fetch did not succeed");
}
})
.then(json => console.log(json.someKey))
.catch(err => console.log(err));
I am just try to do a simple get and print until it works. I am not sure what is happening and why it is not working. Any ideas?