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

View File

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