mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
- lint fixes
This commit is contained in:
parent
c0b25040c3
commit
31038c5c2a
@ -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
|
||||
|
||||
@ -7,4 +7,4 @@ export const queryLocations = () => gql`
|
||||
id
|
||||
}
|
||||
}
|
||||
`
|
||||
`
|
||||
|
||||
@ -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
|
||||
},
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user