- Add function for request game
This commit is contained in:
Kum1ta
2024-09-15 14:02:05 +02:00
parent 1d9db521d3
commit e1b8275c16
4 changed files with 67 additions and 19 deletions

View File

@ -6,7 +6,7 @@
/* By: edbernar <edbernar@student.42angouleme. +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/08/07 17:40:15 by edbernar #+# #+# */
/* Updated: 2024/09/14 23:59:41 by edbernar ### ########.fr */
/* Updated: 2024/09/15 10:32:23 by edbernar ### ########.fr */
/* */
/* ************************************************************************** */
@ -189,18 +189,18 @@ function connect(e)
e.preventDefault();
sendRequest("login", {type: "byPass", mail: mail, password: e.target.password.value});
waitForLogin().then((isConnected) => {
if (isConnected)
{
usernameNode = document.createTextNode(userMeInfo.username);
loginButton.replaceChild(usernameNode, pLoginButton);
CN.new("Connected successfully", "Welcome " + userMeInfo.username, CN.defaultIcon.success);
popout.style.display = 'none';
}
}).catch((err) => {
console.error(err);
CN.new("Error", "An error occured while trying to connect", CN.defaultIcon.error);
});
// waitForLogin().then((isConnected) => {
// if (isConnected)
// {
// usernameNode = document.createTextNode(userMeInfo.username);
// loginButton.replaceChild(usernameNode, pLoginButton);
// CN.new("Connected successfully", "Welcome " + userMeInfo.username, CN.defaultIcon.success);
// popout.style.display = 'none';
// }
// }).catch((err) => {
// console.error(err);
// CN.new("Error", "An error occured while trying to connect", CN.defaultIcon.error);
// });
}
export { Login, changeWindowLoginBack };