diff --git a/accounts/views.txt b/accounts/views.txt deleted file mode 100644 index 397678b..0000000 --- a/accounts/views.txt +++ /dev/null @@ -1,31 +0,0 @@ -# from django.shortcuts import render -from .models import User -from rest_framework import generics, status -from rest_framework.response import Response - -from .serializers import RegisterSerializer, LoginSerializer - - -class RegisterView(generics.CreateAPIView): - queryset = User.objects.all() - serializer_class = RegisterSerializer - - -class LoginView(generics.GenericAPIView): - serializer_class = LoginSerializer - - def post(self, request): - serializer = self.get_serializer(data=request.data) - if serializer.is_valid(): - validated_data = serializer.validated_data - return Response( - { - "token": validated_data["token"], - "user_id": validated_data["user_id"], - "reliability": validated_data["reliability"], - "profile_img_url": validated_data["profile_img_url"], - }, - status=status.HTTP_200_OK, - ) - - return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)