From b048f3425b94d66c7f8eae2005de78bf94896f4f Mon Sep 17 00:00:00 2001 From: Jan Szejko Date: Thu, 9 Aug 2018 17:12:17 +0200 Subject: [PATCH] api: fix unlike --- src/api/handlers.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/api/handlers.py b/src/api/handlers.py index 8d32873fc..af01337d0 100644 --- a/src/api/handlers.py +++ b/src/api/handlers.py @@ -745,13 +745,14 @@ class UserLikeHandler(BaseHandler): return rc.NOT_FOUND return {'likes': likes(request.user, book)} - def create(self, request, slug, action='like'): + def create(self, request, slug): if not request.user.is_authenticated(): return rc.FORBIDDEN try: book = Book.objects.get(slug=slug) except Book.DoesNotExist: return rc.NOT_FOUND + action = request.GET.get('action', 'like') if action == 'like': book.like(request.user) elif action == 'unlike': -- 2.20.1