From 89cdb178ed852f9fae2218584b87cb0e145b5e9d Mon Sep 17 00:00:00 2001 From: carlospelazas Date: Mon, 29 Apr 2024 12:04:36 +0200 Subject: [PATCH] remove unnecessary calls to localstorage --- webapp/src/components/game/multiplayer/LobbyMultiPlayer.tsx | 2 +- webapp/src/components/login/Login.tsx | 3 --- webapp/src/components/register/Register.tsx | 3 --- 3 files changed, 1 insertion(+), 7 deletions(-) diff --git a/webapp/src/components/game/multiplayer/LobbyMultiPlayer.tsx b/webapp/src/components/game/multiplayer/LobbyMultiPlayer.tsx index 7e028ee..dd335be 100644 --- a/webapp/src/components/game/multiplayer/LobbyMultiPlayer.tsx +++ b/webapp/src/components/game/multiplayer/LobbyMultiPlayer.tsx @@ -14,7 +14,7 @@ interface LobbyMultiPlayerProps { const LobbyMultiPlayer: FC = ({ socket, handleCurrentStage, partyCode, users }) => { const [isFetched, setFetched] = useState(true); - const uuid = localStorage.getItem("uuid"); + const uuid = localStorage.getItem("userUUID"); console.log(uuid); const { t } = useTranslation(); diff --git a/webapp/src/components/login/Login.tsx b/webapp/src/components/login/Login.tsx index 8c353fe..26b6b78 100644 --- a/webapp/src/components/login/Login.tsx +++ b/webapp/src/components/login/Login.tsx @@ -29,12 +29,9 @@ const Login = (props: ActionProps) => { try { const user = await axios.post(`${apiEndpoint}/login`, { username, password }); - console.log(user.data); localStorage.setItem("username", user.data.username); localStorage.setItem("score", user.data.totalScore); - localStorage.setItem("nWins", user.data.nWins); - localStorage.setItem("uuid", user.data.uuid); localStorage.setItem("isAuthenticated", JSON.stringify(true)); // Extract data from the response localStorage.setItem('userUUID', user.data.uuid); diff --git a/webapp/src/components/register/Register.tsx b/webapp/src/components/register/Register.tsx index aa05923..2fd4704 100644 --- a/webapp/src/components/register/Register.tsx +++ b/webapp/src/components/register/Register.tsx @@ -27,11 +27,8 @@ const Register = (props:ActionProps) => { setOpenSnackbar(true); const user = await axios.post(`${apiEndpoint}/login`, { username, password }); - console.log(user.data); localStorage.setItem("username", user.data.username); localStorage.setItem("score", user.data.totalScore); - localStorage.setItem("nWins", user.data.nWins); - localStorage.setItem("uuid", user.data.uuid); localStorage.setItem("isAuthenticated", JSON.stringify(true)); // Extract data from the response localStorage.setItem('userUUID', user.data.uuid);