simplify cookie

This commit is contained in:
Ricardo (XenGi) Band 2025-01-22 18:58:29 +01:00
commit 41fdaee2d3
No known key found for this signature in database

View file

@ -8,7 +8,7 @@ getCookie = () => {
c = c.substring(1); c = c.substring(1);
} }
if (c.indexOf(name) === 0) { if (c.indexOf(name) === 0) {
return c.substring(name.length, c.length); return JSON.parse(c.substring(name.length, c.length));
} }
} }
return ""; return "";
@ -201,9 +201,9 @@ ${document.querySelector("#purpose input").value}
// Fill in form from cookie // Fill in form from cookie
const cookie = getCookie(); const cookie = getCookie();
if (cookie !== "") { if (cookie !== "") {
document.querySelector("#name input").value = JSON.parse(cookie).name; document.querySelector("#name input").value = cookie.name;
document.querySelector("#iban input").value = JSON.parse(cookie).iban; document.querySelector("#iban input").value = cookie.iban;
document.querySelector("#bic input").value = JSON.parse(cookie).bic; document.querySelector("#bic input").value = cookie.bic;
} }
validateName(document.querySelector("#name input")); validateName(document.querySelector("#name input"));