- lint fixes

This commit is contained in:
Ulf Gebhardt 2021-01-30 00:21:05 +01:00
parent c0b25040c3
commit 31038c5c2a
No known key found for this signature in database
GPG Key ID: 81308EFE29ABFEBD
3 changed files with 10 additions and 7 deletions

View File

@ -137,11 +137,12 @@ const createOrUpdateLocations = async (userId, locationName, session) => {
})
}
export const queryLocations = async ({place, lang}) => {
const res = await fetch(`https://api.mapbox.com/geocoding/v5/mapbox.places/${place}.json?access_token=${CONFIG.MAPBOX_TOKEN}&types=region,place,country&language=${lang}`)
console.log(res)
export const queryLocations = async ({ place, lang }) => {
const res = await fetch(
`https://api.mapbox.com/geocoding/v5/mapbox.places/${place}.json?access_token=${CONFIG.MAPBOX_TOKEN}&types=region,place,country&language=${lang}`,
)
// Return empty array if no location found or error occurred
if (!res || !res.features) {
// Return empty array if no location found or error occurred
return []
}
return res.features

View File

@ -7,4 +7,4 @@ export const queryLocations = () => gql`
id
}
}
`
`

View File

@ -147,8 +147,10 @@ export default {
const place = encodeURIComponent(value)
const lang = this.$i18n.locale()
const { data: { queryLocations: res }} = await this.$apollo.query({ query: queryLocations(), variables: { place, lang } })
const {
data: { queryLocations: res },
} = await this.$apollo.query({ query: queryLocations(), variables: { place, lang } })
this.cities = this.processLocationsResult(res)
this.loadingGeo = false
},