diff --git a/srcs/frontend/nginx.conf b/srcs/frontend/nginx.conf index 5e6a4b1..59e00c9 100644 --- a/srcs/frontend/nginx.conf +++ b/srcs/frontend/nginx.conf @@ -11,8 +11,10 @@ server { # Backend API location /api/ { - proxy_pass http://backend:3001/; + proxy_pass http://backend:3001; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; } } diff --git a/srcs/frontend/src/index.html b/srcs/frontend/src/index.html index 108c931..ca0085d 100644 --- a/srcs/frontend/src/index.html +++ b/srcs/frontend/src/index.html @@ -7,7 +7,7 @@ -

scribl.lidl_edition

+

scribl.lidl_edition (GARE A VOS YEUX)

diff --git a/srcs/frontend/src/windows.js b/srcs/frontend/src/windows.js index 750f6b9..8ffd234 100644 --- a/srcs/frontend/src/windows.js +++ b/srcs/frontend/src/windows.js @@ -87,6 +87,7 @@ export class LoginWindow extends fenetre { } async connexion() { + console.log("methode connexion lancée"); const response = await fetch("/api/auth/login", { method: "POST", headers: { @@ -110,6 +111,24 @@ export class LoginWindow extends fenetre { async inscription(){ console.log("methode inscription lancée"); + const response = await fetch("/api/auth/register", { + method: "POST", + headers: { + "Content-Type": "application/json" + }, + body: JSON.stringify({ + username: this.username.value, + password: this.password.value + }) + }); + + const data = await response.json(); + + if (response.ok) { + console.log("OK", data); + } else { + console.error("ERROR", data); + } } bindEvents() {