2023-11-29 10:05:49 -05:00
|
|
|
from rest_framework.views import APIView
|
|
|
|
from rest_framework.response import Response
|
|
|
|
from rest_framework import permissions, status
|
|
|
|
from django.http import HttpRequest
|
|
|
|
from django.contrib.auth import login
|
|
|
|
from rest_framework.authentication import SessionAuthentication
|
|
|
|
|
|
|
|
from ..serializers.login import LoginSerializer
|
|
|
|
|
|
|
|
class LoggedView(APIView):
|
|
|
|
|
|
|
|
permission_classes = (permissions.AllowAny,)
|
|
|
|
authentication_classes = (SessionAuthentication,)
|
|
|
|
|
|
|
|
def get(self, request: HttpRequest):
|
2023-12-06 09:19:41 -05:00
|
|
|
if (request.user.is_authenticated):
|
|
|
|
return Response({'id': request.user.pk}, status=status.HTTP_200_OK)
|
2023-12-16 05:58:50 -05:00
|
|
|
return Response('false', status=status.HTTP_200_OK)
|