likes likes
This commit is contained in:
parent
9f9b652ced
commit
05c9474921
@ -17,3 +17,28 @@ router.use(bannerRouter)
|
|||||||
router.use('/v1/auth', authRouter)
|
router.use('/v1/auth', authRouter)
|
||||||
router.use(['/v1/tasks', '/v1/task'], jwtMiddlevare, tasksRouter)
|
router.use(['/v1/tasks', '/v1/task'], jwtMiddlevare, tasksRouter)
|
||||||
router.use('/v1/drafts', jwtMiddlevare, draftsRouter)
|
router.use('/v1/drafts', jwtMiddlevare, draftsRouter)
|
||||||
|
|
||||||
|
const charLikes = {}
|
||||||
|
|
||||||
|
router.get('/likes', (req, res) => {
|
||||||
|
res.send({
|
||||||
|
likes: charLikes,
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
router.post('/toggle-like', (req, res) => {
|
||||||
|
const { id, charId } = req.body
|
||||||
|
|
||||||
|
if (charLikes[charId]) {
|
||||||
|
charLikes[charId].likes.push(id)
|
||||||
|
} else {
|
||||||
|
charLikes[charId] = { likes: [id] }
|
||||||
|
}
|
||||||
|
|
||||||
|
res.send({
|
||||||
|
likes: charLikes,
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
module.exports = router
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user