location saving is not working when geocoding is disabled, fix #238

This commit is contained in:
lesion 2023-02-22 08:45:18 +01:00
parent 07f9e2d9ee
commit 0fa7769844
No known key found for this signature in database
GPG key ID: 352918250B012177
2 changed files with 7 additions and 4 deletions

View file

@ -232,8 +232,8 @@ export default {
}
formData.append('place_name', this.event.place.name.trim())
formData.append('place_address', this.event.place.address)
formData.append('place_latitude', this.event.place.latitude)
formData.append('place_longitude', this.event.place.longitude)
if (this.event.place.latitude) { formData.append('place_latitude', this.event.place.latitude) }
if (this.event.place.longitude) { formData.append('place_longitude', this.event.place.longitude) }
formData.append('description', this.event.description)
formData.append('multidate', !!this.date.multidate)
let [hour, minute] = this.date.fromHour.split(':')

View file

@ -29,6 +29,8 @@ const eventController = {
return place
}
console.error('dentro findOrCreatePlace', body)
const place_name = body.place_name && body.place_name.trim()
const place_address = body.place_address && body.place_address.trim()
if (!place_address || !place_name) {
@ -39,8 +41,8 @@ const eventController = {
place = await Place.create({
name: place_name,
address: place_address,
latitude: body.place_latitude,
longitude: body.place_longitude
latitude: Number(body.place_latitude) || null,
longitude: Number(body.place_longitude) || null
})
}
return place
@ -390,6 +392,7 @@ const eventController = {
return res.status(400).send(`Place not found`)
}
} catch (e) {
log.error(e.message)
return res.status(400).send(e.message)
}