Added cookieManager.js

This commit is contained in:
Yohan Boujon 2024-12-22 00:06:28 +01:00
parent 34938cba02
commit e3ce964ae1
2 changed files with 6 additions and 2 deletions

View file

@ -5,6 +5,7 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://unpkg.com/htmx.org@1.9.12"></script> <!-- Include HTMX -->
<script src="https://gigabyte5671.github.io/CookieManager/cookieManager.min.js" type="text/javascript"></script> <!-- Include CookieManager -->
<script src="base.js"></script> <!-- Include BASE -->
<script src="generated.js"></script> <!-- Include GENERATED -->
<title>HelpApp</title>

View file

@ -13,6 +13,9 @@ function roleDefine() {
document.addEventListener("DOMContentLoaded", () => {
roleDefine();
// setCookie("toto",12,1);
// console.log(checkCookie("toto"));
// console.log(getCookie("toto"));
const loginForm = document.getElementById("login-form");
const loginResponse = document.getElementById("login-response");
@ -32,7 +35,7 @@ document.addEventListener("DOMContentLoaded", () => {
const password = document.getElementById("login-password").value;
try {
const response = await fetch(`${API_BASE}:8083/users/authenticate`, {
const response = await fetch(`${API_BASE}:${USER_PORT}/users/authenticate`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ email, password }),
@ -59,7 +62,7 @@ document.addEventListener("DOMContentLoaded", () => {
const role = document.getElementById("role").value;
try {
const response = await fetch(`${API_BASE}:8083/users`, {
const response = await fetch(`${API_BASE}:${USER_PORT}/users`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ name, email, password, role }),