Fix issue with QR code login and caching. Update README
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user