fix: login btn does not work for readonly annoymous (#620)

This commit is contained in:
sigoden
2025-08-19 08:58:59 +08:00
committed by GitHub
parent f8a7873582
commit 4016715187
3 changed files with 30 additions and 6 deletions

View File

@@ -534,7 +534,7 @@ async function setupAuth() {
$loginBtn.classList.remove("hidden");
$loginBtn.addEventListener("click", async () => {
try {
await checkAuth();
await checkAuth("login");
} catch { }
location.reload();
});
@@ -782,9 +782,10 @@ async function saveChange() {
}
}
async function checkAuth() {
async function checkAuth(variant) {
if (!DATA.auth) return;
const res = await fetch(baseUrl(), {
const qs = variant ? `?${variant}` : "";
const res = await fetch(baseUrl() + qs, {
method: "CHECKAUTH",
});
await assertResOK(res);