register
This commit is contained in:
@@ -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 })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
button.addEventListener("onclick", () => {
|
||||
const email = document.querySelector("#email")
|
||||
const username = document.querySelector("#username")
|
||||
const password = document.querySelector("#password")
|
||||
register(email, username, password)
|
||||
})
|
||||
Reference in New Issue
Block a user