# add jwt

This commit is contained in:
xianfuxing 2018-07-14 17:51:49 +08:00
parent 882983fbd7
commit 8536e99eb7
1 changed files with 2 additions and 2 deletions

View File

@ -1,6 +1,6 @@
from django.contrib.auth import get_user_model
from rest_framework.response import Response
from rest_framework.status import HTTP_200_OK, HTTP_400_BAD_REQUEST
from rest_framework.status import HTTP_201_CREATED, HTTP_400_BAD_REQUEST
from rest_framework.views import APIView
from rest_framework.permissions import AllowAny
from .serializers import UserLoginSerializer
@ -17,6 +17,6 @@ class UserLoginAPIView(APIView):
serializer = UserLoginSerializer(data=data)
if serializer.is_valid(raise_exception=True):
login_data = serializer.data
return Response(login_data, HTTP_200_OK)
return Response(login_data, HTTP_201_CREATED)
else:
return Response(serializer.errors, HTTP_400_BAD_REQUEST)