From 6dc2c215afa513fe6330798cc8042267413a6a26 Mon Sep 17 00:00:00 2001 From: Alessio Comi Date: Sun, 14 Apr 2024 19:49:19 +0200 Subject: [PATCH] refactor signup by register --- api/masteriqapp/views/AuthenticationView.py | 4 ++-- frontend/src/api_client.js | 2 +- frontend/src/components/Header.vue | 2 +- frontend/src/router/index.js | 6 +++--- .../Authentication/{SignUpView.vue => RegisterView.vue} | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) rename frontend/src/views/Authentication/{SignUpView.vue => RegisterView.vue} (98%) diff --git a/api/masteriqapp/views/AuthenticationView.py b/api/masteriqapp/views/AuthenticationView.py index 420df27..6bf73ee 100644 --- a/api/masteriqapp/views/AuthenticationView.py +++ b/api/masteriqapp/views/AuthenticationView.py @@ -24,12 +24,12 @@ def logout(self, request): return Response({'message': 'Logout successful'}, status=status.HTTP_200_OK) @action(detail=False, methods=['POST'], permission_classes=[AllowAny]) - def signup(self, request): + def register(self, request): username = request.data.get('username') password = request.data.get('password') if not User.objects.filter(username=username).exists(): user = User.objects.create_user(username=username, password=password) login(request, user) - return Response({'message': 'Signup successful'}, status=status.HTTP_201_CREATED) + return Response({'message': 'Register successful'}, status=status.HTTP_201_CREATED) else: return Response({'message': 'Username already exists'}, status=status.HTTP_400_BAD_REQUEST) diff --git a/frontend/src/api_client.js b/frontend/src/api_client.js index 47262ec..0d1e9ca 100644 --- a/frontend/src/api_client.js +++ b/frontend/src/api_client.js @@ -154,7 +154,7 @@ export default */ static async registerUser(username, password) { try { - const response = await axios.post('/api/user/signup/', { + const response = await axios.post('/api/user/register/', { username, password }); diff --git a/frontend/src/components/Header.vue b/frontend/src/components/Header.vue index 03628e0..5d76090 100644 --- a/frontend/src/components/Header.vue +++ b/frontend/src/components/Header.vue @@ -11,7 +11,7 @@ import { RouterLink } from 'vue-router' Add question Login Logout - SignUp + Register diff --git a/frontend/src/router/index.js b/frontend/src/router/index.js index ee9531b..1496d36 100644 --- a/frontend/src/router/index.js +++ b/frontend/src/router/index.js @@ -30,9 +30,9 @@ const router = createRouter({ component: () => import('../views/Authentication/LogoutView.vue') }, { - path: '/signup', - name: 'Signup', - component: () => import('../views/Authentication/SignUpView.vue') + path: '/register', + name: 'Register', + component: () => import('../views/Authentication/RegisterView.vue') } ] }) diff --git a/frontend/src/views/Authentication/SignUpView.vue b/frontend/src/views/Authentication/RegisterView.vue similarity index 98% rename from frontend/src/views/Authentication/SignUpView.vue rename to frontend/src/views/Authentication/RegisterView.vue index 9f65ef3..27706a4 100644 --- a/frontend/src/views/Authentication/SignUpView.vue +++ b/frontend/src/views/Authentication/RegisterView.vue @@ -40,7 +40,7 @@ const register = async () => {