[WEB-1019] chore: error state for unauthorized pages (#4219)

* chore: private page access

* chore: add error state for private pages

---------

Co-authored-by: NarayanBavisetti <narayan3119@gmail.com>
This commit is contained in:
Aaryan Khandelwal 2024-04-17 14:53:01 +05:30 committed by GitHub
parent 1080094b01
commit 1880eb7704
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 226 additions and 184 deletions

View file

@ -169,9 +169,15 @@ class PageViewSet(BaseViewSet):
def retrieve(self, request, slug, project_id, pk=None):
page = self.get_queryset().filter(pk=pk).first()
return Response(
PageDetailSerializer(page).data, status=status.HTTP_200_OK
)
if page is None:
return Response(
{"error": "Page not found"},
status=status.HTTP_404_NOT_FOUND,
)
else:
return Response(
PageDetailSerializer(page).data, status=status.HTTP_200_OK
)
def lock(self, request, slug, project_id, pk):
page = Page.objects.filter(