Fix return value of /building/<id>/like.json

- update to fix log noise meant this was always returning true
This commit is contained in:
Tom Russell 2019-03-18 19:51:55 +00:00
parent 29f3bff0d5
commit d523e2b8a2

View File

@ -262,12 +262,8 @@ server.route('/building/:building_id/like.json')
}
const { building_id } = req.params;
getBuildingLikeById(building_id, req.session.user_id).then(like => {
if (typeof (like) === "undefined") {
res.send({ like: false })
return
}
// any value returned means like
res.send({ like: true })
res.send({ like: like })
}).catch(
() => res.send({ error: 'Database error' })
)