Fix issue with QR code login and caching. Update README

This commit is contained in:
Ettore
2026-05-10 16:22:31 +02:00
parent a5470544a1
commit c4355eb371
3 changed files with 60 additions and 10 deletions

View File

@@ -215,15 +215,18 @@ document.getElementById("logout-btn").addEventListener("click", () => {
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ code: k.toUpperCase() }),
})
.then(res => res.ok ? res.json() : Promise.reject())
.then(res => res.ok ? res.json() : res.json().then(j => Promise.reject(j.detail || "Invalid keypass")))
.then(data => {
saveToken(data.token);
showGatesView();
loadGates();
})
.catch(() => {
.catch(msg => {
clearToken();
showLogin();
const errEl = document.getElementById("login-error");
errEl.textContent = typeof msg === "string" ? msg : "QR code login failed";
errEl.classList.remove("hidden");
});
return;
}