From 467421ce38f3ca1019d697345b0810475d430053 Mon Sep 17 00:00:00 2001 From: ParthipPR Date: Wed, 28 Aug 2024 11:17:28 +0530 Subject: [PATCH] "Fix: corrected the bugs in userterm api" --- api/dashboard/profile/profile_view.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/api/dashboard/profile/profile_view.py b/api/dashboard/profile/profile_view.py index 555789d5..63636646 100644 --- a/api/dashboard/profile/profile_view.py +++ b/api/dashboard/profile/profile_view.py @@ -449,10 +449,11 @@ def post(self, request,muid): if serializer.is_valid(): settings = serializer.save() if settings.is_userterms_approved: + response_data = {"message": "User terms have been successfully approved."} return CustomResponse(response=response_data).get_success_response() else: return CustomResponse(response="The given muid seems to be invalid").get_failure_response() - return CustomResponse(response=response_data).get_failure_response() + return CustomResponse(response="Invalid data provided.").get_failure_response() def get(self,request,muid): user = User.objects.get(muid=muid) @@ -461,6 +462,8 @@ def get(self,request,muid): except UserSettings.DoesNotExist: return CustomResponse(response="The user settings doesn't exists").get_failure_response() if settings.is_userterms_approved: + response_data = {"message": "User terms are approved."} return CustomResponse(response=response_data).get_success_response() else: + response_data = {"message": "User terms are not approved."} return CustomResponse(response=response_data).get_failure_response()