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}) => {
|
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
|
||||||
|
|||||||
@ -7,4 +7,4 @@ export const queryLocations = () => gql`
|
|||||||
id
|
id
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
`
|
`
|
||||||
|
|||||||
@ -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
|
||||||
},
|
},
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user