gestion de connexion (pas finis)

This commit is contained in:
2026-01-10 17:32:50 +01:00
parent a1c08ab9dc
commit ad37e26426
2 changed files with 22 additions and 7 deletions
+1 -4
View File
@@ -1,14 +1,11 @@
import {Element, MenuElement} from "./element.js";
import {Grid} from "./grid.js";
import {fenetre, LoginWindow} from "./windows.js";
function direBonjour() {
alert("clicked !");
}
const menuElement = new Element("menu");
const loginElement = new MenuElement("login");
const registeredElement = new MenuElement("registered");
+21 -3
View File
@@ -86,11 +86,29 @@ export class LoginWindow extends fenetre {
this.body.style.gap = "8px";
}
connexion(){
console.log("methode connexion lancée");
async connexion() {
const response = await fetch("/api/login", {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify({
username: "nom",
password: "a"
})
});
const data = await response.json();
if (response.ok) {
console.log("OK", data);
} else {
console.error("ERROR", data);
}
}
inscription(){
async inscription(){
console.log("methode inscription lancée");
}