-
{t('join_group_button')}
+
{t('no_group_join_group')}
{groups.map((group) => (
@@ -123,16 +114,12 @@ const NoGroup = (props: ActionProps) =>
{group.numMembers}/{group.maxNumUsers}
-
-
-
+
))}
-
-
-
+
diff --git a/webapp/src/components/init/Init.tsx b/webapp/src/components/init/Init.tsx
index 2ec55073..8f99622a 100644
--- a/webapp/src/components/init/Init.tsx
+++ b/webapp/src/components/init/Init.tsx
@@ -15,7 +15,7 @@ const Init = (props:ActionProps) =>{
const handleViewChange = (isLoginView: boolean) => {
setCurrentView(isLoginView ? 'login' : 'register');
props.changeView(isLoginView);
- document.title = isLoginView ? t('Conocer y Vencer - Login') : t('Conocer y Vencer - Register');
+ document.title = isLoginView ? (t('app_name') + '-' + t('login')) : (t('app_name') + '-' + t('register'));
};
return (
diff --git a/webapp/src/components/login/Login.test.js b/webapp/src/components/login/Login.test.js
index 715c2598..22272c62 100644
--- a/webapp/src/components/login/Login.test.js
+++ b/webapp/src/components/login/Login.test.js
@@ -41,7 +41,7 @@ describe('Login component', () => {
// Wait for the Snackbar to be open
await waitFor(() => {
- expect(screen.getByText(/Login successful/i)).toBeInTheDocument();
+ expect(screen.getByTestId("login-successfull-snackbar")).toBeInTheDocument();
});
// Verify local storage is set correctly
@@ -77,7 +77,7 @@ describe('Login component', () => {
// Wait for the error Snackbar to be open
await waitFor(() => {
- expect(screen.getByText(/Error: Internal Server Error/i)).toBeInTheDocument();
+ expect(screen.getByTestId('login-error-snackbar')).toBeInTheDocument();
});
// Verify local storage is not set when there's an error
diff --git a/webapp/src/components/login/Login.tsx b/webapp/src/components/login/Login.tsx
index 3df7ff6f..8b105c8d 100644
--- a/webapp/src/components/login/Login.tsx
+++ b/webapp/src/components/login/Login.tsx
@@ -1,4 +1,3 @@
-// src/components/Login.js
import { useState, KeyboardEvent } from 'react';
import axios from 'axios';
import { Container, Typography, TextField, Snackbar, Button, Stack } from '@mui/material';
@@ -21,8 +20,6 @@ const Login = (props: ActionProps) => {
//const apiEndpoint = 'http://conoceryvencer.xyz:8000'
const apiEndpoint = process.env.REACT_APP_API_ENDPOINT;
- console.log(apiEndpoint);
-
const handleReturnButtonClick = () => {
document.title = "Conocer y Vencer";
props.goBack();
@@ -34,7 +31,6 @@ const Login = (props: ActionProps) => {
localStorage.clear();
const user = await axios.post(`${apiEndpoint}/login`, { username, password });
- console.log(user);
localStorage.setItem("username", user.data.username);
localStorage.setItem("score", user.data.totalScore);
localStorage.setItem("nWins", user.data.nWins);
@@ -70,14 +66,14 @@ const Login = (props: ActionProps) => {
setUsername(e.target.value)}
/>
setPassword(e.target.value)}
@@ -91,9 +87,9 @@ const Login = (props: ActionProps) => {
{t('return')}
-
+
{error && (
- setError('')} message={`Error: ${error}`} />
+ setError('')} message={`Error: ${error}`} />
)}