From 8b110385bf72f1be2b96770e27d95ae935d246af Mon Sep 17 00:00:00 2001 From: Gilles <43683714+corp-0@users.noreply.github.com> Date: Sat, 2 Mar 2024 21:27:23 -0300 Subject: [PATCH] fix: standardize the login successful response (#88) --- src/accounts/api/views.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/accounts/api/views.py b/src/accounts/api/views.py index c472c8d..21aedc7 100644 --- a/src/accounts/api/views.py +++ b/src/accounts/api/views.py @@ -61,10 +61,11 @@ def get_post_response_data(self, request, token, instance): ) serializer = self.get_user_serializer_class() + data = { + "account": serializer(request.user, context=self.get_context()).data, + "token": token, + } - data = {"token": token} - if serializer is not None: - data["user"] = serializer(request.user, context=self.get_context()).data return data def get_user_serializer_class(self):