Skip to content

Commit

Permalink
jwt permission연동 작업 중
Browse files Browse the repository at this point in the history
  • Loading branch information
ZeVicTech committed May 8, 2023
1 parent 80b6f24 commit a0f598d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
Binary file modified backend/post/__pycache__/views.cpython-310.pyc
Binary file not shown.
6 changes: 6 additions & 0 deletions backend/post/views.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import jwt
from rest_framework.permissions import IsAuthenticatedOrReadOnly
from rest_framework.views import APIView
from rest_framework.generics import ListCreateAPIView, get_object_or_404
Expand All @@ -23,6 +24,7 @@ def list(self, request):
return Response(serializer.data, status=HTTP_200_OK)



class DetailPostView(APIView):
permission_classes = [IsAuthenticatedOrReadOnly, IsOwnerOrReadOnly]
# 00-02 post 상세 조회
Expand All @@ -42,6 +44,10 @@ def put(self, request, pk):
return Response(serializer.errors, status=HTTP_400_BAD_REQUEST)

def delete(self, request, pk):
# 토큰을 받아서 user인증하는 방법 구현중
token = request.GET('token')
print(token)
# payload = jwt.decode(token,)
post = get_object_or_404(Post, id=pk)
post.delete()
# serializer = PostSerializer(post)

0 comments on commit a0f598d

Please sign in to comment.