From fbf07e772dd2c10d69446b183c129f671bb74218 Mon Sep 17 00:00:00 2001 From: Lukian LEIZOUR Date: Tue, 4 Jun 2024 15:14:31 +0200 Subject: [PATCH] commit --- src/assets/HelpButton.jsx | 8 ++++++-- src/pages/Home.jsx | 2 +- src/pages/Login.jsx | 2 +- src/pages/Register.jsx | 4 ++-- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/assets/HelpButton.jsx b/src/assets/HelpButton.jsx index 0b75ad0..53a657d 100644 --- a/src/assets/HelpButton.jsx +++ b/src/assets/HelpButton.jsx @@ -7,13 +7,13 @@ export default function HelpButton({ gameid, helpingprop, token }) { console.log("helpingprop:", helpingprop) function addHelper() { - axios.post("http://leizour.fr:3000/api/v1/games/addHelper", { token, gameid }) + axios.post("https://leizour.fr/api/v1/games/addHelper", { token, gameid }) .then(() => setHelping(true)) .catch((error) => console.error("Error adding helper")); } function removeHelper() { - axios.post("http://leizour.fr:3000/api/v1/games/removeHelper", { token, gameid }) + axios.post("https://leizour.fr/api/v1/games/removeHelper", { token, gameid }) .then(() => setHelping(false)) .catch((error) => console.error("Error removing helper")); } @@ -27,6 +27,10 @@ export default function HelpButton({ gameid, helpingprop, token }) { } } + useEffect(() => { + setHelping(helpingprop); + }, [helpingprop]); + useEffect(() => { if (helping) { document.getElementById(`helpbutton-${gameid}`).classList.add("helpButton-enabled"); diff --git a/src/pages/Home.jsx b/src/pages/Home.jsx index fbf44f6..6d3f6e6 100644 --- a/src/pages/Home.jsx +++ b/src/pages/Home.jsx @@ -31,7 +31,7 @@ export default function Home() { async function fetchGames() { setLoading(true); try { - const response = await axios.post("https://leizour.fr:3000/api/v1/games/getall", { token: tokenLocal }); + const response = await axios.post("https://leizour.fr/api/v1/games/getall", { token: tokenLocal }); setGames(response.data); } catch (error) { console.error("Error fetching games:", error); diff --git a/src/pages/Login.jsx b/src/pages/Login.jsx index 8c6e296..c906ad4 100644 --- a/src/pages/Login.jsx +++ b/src/pages/Login.jsx @@ -23,7 +23,7 @@ export default function Login() { } try { - const response = await axios.post("https://leizour.fr:3000/api/v1/auth/login", { + const response = await axios.post("https://leizour.fr/api/v1/auth/login", { username: username, password: password }) diff --git a/src/pages/Register.jsx b/src/pages/Register.jsx index 5fd5c4f..2d759c0 100644 --- a/src/pages/Register.jsx +++ b/src/pages/Register.jsx @@ -24,14 +24,14 @@ export default function Register() { } try { - const response = await axios.post("https://leizour.fr:3000/api/v1/auth/register", { + const response = await axios.post("https://leizour.fr/api/v1/auth/register", { username: username, name: name, lastname: lastname, password: password }) - const loginResponse = await axios.post("https://leizour.fr:3000/api/v1/auth/login", { + const loginResponse = await axios.post("https://leizour.fr/api/v1/auth/login", { username: username, password: password })