commit
This commit is contained in:
parent
4bb31eb679
commit
fbf07e772d
4 changed files with 10 additions and 6 deletions
|
@ -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");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue