mirror of
https://github.com/IT4Change/Ocelot-Social.git
synced 2025-12-13 07:45:56 +00:00
Add temporarily console.log statements to debug failed API call
- in production environment, the user locationName is updated, but it is failing the `createOrUpdateLocations` function in backend/src/middleware/nodes/locations.js For some reason, it seems like the API call is coming back with something other than what we are looking for. Need help debugging... we can remove this code after we figure out what's wrong
This commit is contained in:
parent
e819ade8cb
commit
2aef2add3d
@ -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')
|
||||
|
||||
@ -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
|
||||
})
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user