gestion de connexion (pas finis)
This commit is contained in:
@@ -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");
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user