remove fcm token

This commit is contained in:
abutalib-kiwi
2023-07-18 16:03:39 +05:30
parent ba4d5933de
commit 3d84c03163
4 changed files with 21 additions and 3 deletions

View File

@ -1,4 +1,6 @@
"""Account view """
from notifications.utils import remove_fcm_token
"""Django import"""
from datetime import datetime, timedelta
from rest_framework import viewsets, status, views
@ -531,6 +533,10 @@ class LogoutAPIView(views.APIView):
permission_classes = (IsAuthenticated,)
def post(self, request):
remove_fcm_token(
request.auth.payload['user_id'],
request.META['HTTP_AUTHORIZATION'].split(" ")[1],
request.data.get('registration_id', ""))
logout(request)
request.session.flush()
return custom_response(SUCCESS_CODE['3020'], response_status=status.HTTP_200_OK)