also for cookie deletion

This commit is contained in:
Grigoriy Beziuk 2017-06-30 14:23:56 +03:00
parent 2672263100
commit 46fd16700a

View File

@ -133,8 +133,13 @@ class LogoutView(APIView):
django_logout(request)
return Response({"detail": _("Successfully logged out.")},
status=status.HTTP_200_OK)
response = Response({"detail": _("Successfully logged out.")},
status=status.HTTP_200_OK)
if getattr(settings, 'REST_USE_JWT', False):
from rest_framework_jwt.settings import api_settings as jwt_settings
if jwt_settings.JWT_AUTH_COOKIE:
response.delete_cookie(jwt_settings.JWT_AUTH_COOKIE)
return response
class UserDetailsView(RetrieveUpdateAPIView):