diff --git a/js/index.js b/js/index.js index 9e25ccd..373da26 100644 --- a/js/index.js +++ b/js/index.js @@ -7,6 +7,13 @@ $(document).ready(function () { }); function setEvents() { + const heartEl = document.querySelector('body > h1 > span'); + heartEl.addEventListener('click', function() { + const key = prompt('Introduce la clave'); + if (key === null) return + localStorage.setItem('vnKey', key); + }); + $(".btnnum").on("click", function () { pin += parseInt($(this).children().html()); $("#txtPin").text(pin); diff --git a/js/main.js b/js/main.js index d7273da..33d9a8f 100644 --- a/js/main.js +++ b/js/main.js @@ -19,6 +19,11 @@ function printError(msg){ $.ajaxPrefilter(function(xhr) { var orgErrorHandler = xhr.error; + var key = localStorage.getItem('vnKey'); + if (key) { + xhr.jsonData.push(key) + } + Object.assign(xhr, { url: `${urlBase}/workerTimeControl/${xhr.urlPath}`, headers: { diff --git a/package-lock.json b/package-lock.json index 6465606..8e14c92 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "es.verdnatura.worker-time-control", - "version": "1.0.0", + "version": "1.0.1", "lockfileVersion": 1, "requires": true, "dependencies": {