fix: change res.end to .json
This commit is contained in:
1 parent
490d097e01
commit
353a88bc9c
2 files changed
+4
-4
No files matched your search
+1
-1
@@ -7,7 +7,7 @@ const router = express.Router()
|
||||
|
||||
router.post('/batch/', ({ body: { tids } }, res) => {
|
||||
if (tids === undefined) return res.status(400).end('Track ids array required')
|
||||
if (tids.length < 1) return res.end([])
|
||||
if (tids.length < 1) return res.send([])
|
||||
|
||||
Promise.all(tids.map((tid) => db.tracks.get(tid)))
|
||||
.then((tracks) => res.send(tracks))
|
||||
|
||||
+3
-3
@@ -24,7 +24,7 @@ router.post(
|
||||
|
||||
if (tids === undefined)
|
||||
return res.status(400).end('List of Track ids required')
|
||||
if (tids.length < 1) return res.end([])
|
||||
if (tids.length < 1) return res.json([])
|
||||
|
||||
Promise.all([
|
||||
Promise.all(tids.map((tid) => db.votes.getTrackStats(tid))),
|
||||
@@ -112,7 +112,7 @@ router.patch(
|
||||
db.votes
|
||||
.putUserTrack(tid, id, value)
|
||||
.then((ok) => {
|
||||
res.end(ok.toString())
|
||||
res.json(ok.toString())
|
||||
console.info(`vote# ${id} ${value} ${tid}`)
|
||||
})
|
||||
.catch((err) => {
|
||||
@@ -121,7 +121,7 @@ router.patch(
|
||||
})
|
||||
})
|
||||
.catch((err) => {
|
||||
res.end('false')
|
||||
res.json('false')
|
||||
console.error(err)
|
||||
})
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user