diff --git a/pages/add/_edit.vue b/pages/add/_edit.vue index 820c76a2..59efe93a 100644 --- a/pages/add/_edit.vue +++ b/pages/add/_edit.vue @@ -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(':') diff --git a/server/api/controller/event.js b/server/api/controller/event.js index 73592c04..46849094 100644 --- a/server/api/controller/event.js +++ b/server/api/controller/event.js @@ -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) }