#6555 refactor to js #28

Merged
jorgep merged 13 commits from 6555-refactorToJs into test 2024-10-10 13:51:47 +00:00
2 changed files with 9 additions and 11 deletions
Showing only changes of commit b2fa1d341b - Show all commits

View File

@ -4,6 +4,7 @@ if ("addEventListener" in document) {
FastClick.attach(document.body); FastClick.attach(document.body);
const heartEl = document.querySelector("body > h1 > span"); const heartEl = document.querySelector("body > h1 > span");
const txtPin = document.querySelector("#txtPin");
refreshDeviceLabel(); refreshDeviceLabel();
heartEl.addEventListener("click", () => { heartEl.addEventListener("click", () => {
@ -22,21 +23,19 @@ if ("addEventListener" in document) {
}); });
}); });
$(".btnnum").on("click", function () { document.querySelectorAll(".btnnum").forEach((btn) => {
pin += parseInt($(this).children().html()); btn.addEventListener("click", (e) => {
$("#txtPin").text(pin); pin += +e.currentTarget.children[0].innerHTML;
txtPin.textContent = pin;
});
}); });
$(".btnCancel").on("click", function () { document.querySelector(".btnCancel").addEventListener("click", () => {
pin = ""; pin = "";
$("#txtPin").text("ID USUARIO"); txtPin.textContent = "ID USUARIO";
}); });
$(".btnOk").on("click", function () { document.querySelector(".btnOk").addEventListener("click", () => pin && login());
if (pin) {
login();
}
});
}); });
} }

View File

@ -80,7 +80,6 @@ async function call(url, { method = "GET", body = {}, params = {} }) {
for (let [key, value] of Object.entries(params)) { for (let [key, value] of Object.entries(params)) {
searchParams.append(key, typeof value === "object" ? JSON.stringify(value) : value); searchParams.append(key, typeof value === "object" ? JSON.stringify(value) : value);
} }
url += "?" + searchParams.toString(); url += "?" + searchParams.toString();
} else if (method === "POST") opts.body = JSON.stringify(body); } else if (method === "POST") opts.body = JSON.stringify(body);