Hide admin panel when unauthenticated

This commit is contained in:
2026-01-29 01:19:52 +01:00
parent c318cfd120
commit 1ba7fd5c37

View File

@@ -31,6 +31,10 @@ function setAuthUI(isAuthed) {
if (authCard) authCard.classList.toggle("hidden", isAuthed); if (authCard) authCard.classList.toggle("hidden", isAuthed);
const adminToggle = $("admin-toggle"); const adminToggle = $("admin-toggle");
if (adminToggle) adminToggle.classList.toggle("hidden", !isAuthed || !state.me?.isAdmin); if (adminToggle) adminToggle.classList.toggle("hidden", !isAuthed || !state.me?.isAdmin);
if (!isAuthed) {
const adminCard = $("admin-card");
if (adminCard) adminCard.classList.add("hidden");
}
} }
function setAuthMode(mode) { function setAuthMode(mode) {
@@ -51,6 +55,8 @@ function clearUserState() {
state.allSuggestions = []; state.allSuggestions = [];
state.myVotes = []; state.myVotes = [];
state.results = []; state.results = [];
const adminCard = $("admin-card");
if (adminCard) adminCard.classList.add("hidden");
} }
function handleAuthError(err) { function handleAuthError(err) {