- 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}) => { 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}`) const res = await fetch(
console.log(res) `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) { if (!res || !res.features) {
// Return empty array if no location found or error occurred
return [] return []
} }
return res.features return res.features

View File

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

View File

@ -147,8 +147,10 @@ export default {
const place = encodeURIComponent(value) const place = encodeURIComponent(value)
const lang = this.$i18n.locale() 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.cities = this.processLocationsResult(res)
this.loadingGeo = false this.loadingGeo = false
}, },