From 5b5dc610bc0da17fd006982de50b4dc74b134a54 Mon Sep 17 00:00:00 2001 From: Mark Powers Date: Tue, 5 Jan 2021 20:25:10 -0600 Subject: Refactor likes to use JS to avoid redirect --- src/server.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/server.js') diff --git a/src/server.js b/src/server.js index 07da08c..773feb0 100644 --- a/src/server.js +++ b/src/server.js @@ -153,7 +153,7 @@ function setUpRoutes(models, jwtFunctions, database, templates) { where: { type, id }, }); post.update({likes: post.likes+1}) - res.redirect(`/post/${type}/${id}`); + res.status(200).send({likes: post.likes}); }) server.get('/tags/:name', async (req, res) => { const { name } = req.params; -- cgit v1.2.3