Compare commits
8 Commits
Author | SHA1 | Date | |
---|---|---|---|
0970d3e83b | |||
4e77185a33 | |||
0ef9958ebd | |||
a8f111995f | |||
38064eff2b | |||
25b3320665 | |||
db4d1980a8 | |||
05c9474921 |
4
package-lock.json
generated
4
package-lock.json
generated
@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "red-coder-bh",
|
"name": "red-coder-bh",
|
||||||
"version": "1.3.1",
|
"version": "1.3.3",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "red-coder-bh",
|
"name": "red-coder-bh",
|
||||||
"version": "1.3.1",
|
"version": "1.3.3",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@ijl/mailer": "^1.1.0",
|
"@ijl/mailer": "^1.1.0",
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "red-coder-bh",
|
"name": "red-coder-bh",
|
||||||
"version": "1.3.1",
|
"version": "1.3.3",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "src/main.ts",
|
"main": "src/main.ts",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
@ -17,3 +17,40 @@ 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.set({
|
||||||
|
'Access-Control-Allow-Origin': 'http://admin.inno-js.ru',
|
||||||
|
})
|
||||||
|
res.send({
|
||||||
|
likes: charLikes,
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
router.post('/toggle-like', (req, res) => {
|
||||||
|
const { id, charId } = req.body
|
||||||
|
|
||||||
|
if (charLikes[charId]) {
|
||||||
|
const currentLikes = new Set(charLikes[charId].likes)
|
||||||
|
|
||||||
|
if (currentLikes.has(id)) {
|
||||||
|
currentLikes.delete(id)
|
||||||
|
} else {
|
||||||
|
currentLikes.add(id)
|
||||||
|
}
|
||||||
|
|
||||||
|
charLikes[charId].likes = [...currentLikes]
|
||||||
|
} else {
|
||||||
|
charLikes[charId] = { likes: [id] }
|
||||||
|
}
|
||||||
|
|
||||||
|
res.set({
|
||||||
|
'Access-Control-Allow-Origin': 'http://admin.inno-js.ru',
|
||||||
|
})
|
||||||
|
res.send({
|
||||||
|
likes: charLikes,
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user