Google Places API:INVALID_REQUEST

时间:2019-01-22 21:52:59

标签: react-native google-places-api google-places

嗨,我正在尝试使用Google Places API,但我一直处于INVALID_REQUEST状态,我的网址看起来像这样,下面是我的代码。

https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=-122.449833,37.479942&radius=10000&key=MY_API_KEY

const url = 'https://maps.googleapis.com/maps/api/place/nearbysearch/json?' + 'location=' + region.longitude + ',' + region.latitude + '&radius=10000' + '&key=' + API_KEY;

// console.log(url)
// axios.get(url).then((response) => {
//     console.log(response)
// }).catch((err) => {
//     console.log(err)
// })

fetch(url).then((response) => {
    console.log(response.json())
})
.catch((err) => {
    console.log(err)
})

0 个答案:

没有答案