diff --git a/backend/src/middleware/nodes/locations.js b/backend/src/middleware/nodes/locations.js index d7abb90ff..8a11d8e55 100644 --- a/backend/src/middleware/nodes/locations.js +++ b/backend/src/middleware/nodes/locations.js @@ -59,13 +59,21 @@ const createOrUpdateLocations = async (userId, locationName, driver) => { if (isEmpty(locationName)) { return } - const res = await fetch( - `https://api.mapbox.com/geocoding/v5/mapbox.places/${encodeURIComponent( - locationName, - )}.json?access_token=${CONFIG.MAPBOX_TOKEN}&types=region,place,country&language=${locales.join( - ',', - )}`, - ) + let res + try { + res = await fetch( + `https://api.mapbox.com/geocoding/v5/mapbox.places/${encodeURIComponent( + locationName, + )}.json?access_token=${ + CONFIG.MAPBOX_TOKEN + }&types=region,place,country&language=${locales.join(',')}`, + ) + /* eslint-disable-next-line no-console */ + console.log('res', res) + } catch (error) { + /* eslint-disable-next-line no-console */ + console.log('error', error) + } if (!res || !res.features || !res.features[0]) { throw new UserInputError('locationName is invalid') diff --git a/webapp/pages/settings/index.vue b/webapp/pages/settings/index.vue index eb6fbbd33..5c99f4b8b 100644 --- a/webapp/pages/settings/index.vue +++ b/webapp/pages/settings/index.vue @@ -101,7 +101,7 @@ export default { async submit() { this.loadingData = true const { name, about } = this.formData - let { locationName } = this.formData + let { locationName } = this.formData || this.currentUser locationName = locationName && (locationName['label'] || locationName) try { await this.$apollo.mutate({ @@ -175,10 +175,6 @@ export default { .then(res => { this.cities = this.processCityResults(res) }) - .catch(error => { - /* eslint-disable-next-line no-console */ - console.log(error) - }) .finally(() => { this.loadingGeo = false })