- {LOCALES.map((l) => (
-
{LOCALE_NAMES[l]}
- ))}
+
@@ -98,13 +133,10 @@ const categories: { label: string; value: PortfolioCategory | 'Trending Colors'
import { getUser, fetchMe, clearSession } from "../lib/auth.ts"
const slot = document.getElementById("auth-slot")
function render(user) {
- if (user) {
- slot.innerHTML = `
Hi, ${user.username}`
- const btn = slot.querySelector("#logout-btn")
- if (btn) btn.addEventListener("click", () => { clearSession(); location.reload() })
- } else {
- slot.innerHTML = `
LoginSignup`
- }
+ if (!user) return // 未登录:保留 SSR 渲染的 Login/Signup(已带语言前缀,无需重写)
+ slot.innerHTML = `
Hi, ${user.username}`
+ const btn = slot.querySelector("#logout-btn")
+ if (btn) btn.addEventListener("click", () => { clearSession(); location.reload() })
}
const cached = getUser()
if (cached) render(cached)
@@ -140,30 +172,6 @@ const categories: { label: string; value: PortfolioCategory | 'Trending Colors'