Merge pull request #224 from tomalrussell/feature/reduce_log_noise
Feature/reduce log noise
This commit is contained in:
commit
831bde542f
@ -84,7 +84,7 @@ function getBuildingById(id) {
|
||||
}
|
||||
|
||||
function getBuildingLikeById(building_id, user_id) {
|
||||
return db.one(
|
||||
return db.oneOrNone(
|
||||
"SELECT true as like FROM building_user_likes WHERE building_id = $1 and user_id = $2 LIMIT 1",
|
||||
[building_id, user_id]
|
||||
).then(res => {
|
||||
|
@ -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' })
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user