ecoffee/app/javascript/save_password.js

12 lines
347 B
JavaScript

const id = document.getElementById("public_id");
const pwd = document.getElementById("password");
const ls = window.localStorage;
if (id && pwd) {
ls.setItem(`ecoffee-pwd:${id.dataset.content}`, pwd.dataset.content);
}
let loc = new URL(window.location.href);
loc.search = "";
loc.pathname = `/${id.dataset.content}`;
window.location = loc;