diff --git a/data/static/register.html b/data/static/register.html index e514a0f..ebb3fd0 100644 --- a/data/static/register.html +++ b/data/static/register.html @@ -27,7 +27,7 @@ - + Créer mon compte ! diff --git a/data/static/register.js b/data/static/register.js index e90b9e5..3fd2078 100644 --- a/data/static/register.js +++ b/data/static/register.js @@ -1,13 +1,15 @@ -async function register() { +const button = document.querySelector("#register") + +async function register(email, username, password) { const response = await fetch("https://yggdrasil.azures.fr/register", { method: "POST", headers: { "content-type": "application/json" }, body: JSON.stringify({ - email: email.value, - username: username.value, - password: password.value + email, + username, + password }) }) const json = await response.json() @@ -17,4 +19,11 @@ async function register() { console.log(json) return iziToast.success({ title: "Succès", message: json.message }) } -} \ No newline at end of file +} + +button.addEventListener("onclick", () => { + const email = document.querySelector("#email") + const username = document.querySelector("#username") + const password = document.querySelector("#password") + register(email, username, password) +}) \ No newline at end of file