2023-11-11 13:50:14 -05:00
|
|
|
from rest_framework.views import APIView
|
2023-10-31 16:14:24 -04:00
|
|
|
from django.contrib.auth import logout
|
2023-11-11 13:50:14 -05:00
|
|
|
from rest_framework import permissions, status
|
|
|
|
from rest_framework.response import Response
|
|
|
|
from django.http import HttpRequest
|
|
|
|
from rest_framework.authentication import SessionAuthentication
|
2023-10-31 16:14:24 -04:00
|
|
|
|
2023-11-11 13:50:14 -05:00
|
|
|
class LogoutView(APIView):
|
|
|
|
permission_classes = (permissions.IsAuthenticated,)
|
|
|
|
authentication_classes = (SessionAuthentication,)
|
2023-11-29 10:05:49 -05:00
|
|
|
def get(self, request: HttpRequest):
|
2023-11-11 13:50:14 -05:00
|
|
|
logout(request)
|
|
|
|
return Response("user unlogged", status=status.HTTP_200_OK)
|