diff --git a/app/portal/account/AccountClient.tsx b/app/portal/account/AccountClient.tsx deleted file mode 100644 index e9d19b28..00000000 --- a/app/portal/account/AccountClient.tsx +++ /dev/null @@ -1,62 +0,0 @@ -// app/portal/account/AccountPanel.tsx -"use client"; - -import { useEffect, useState } from "react"; - -type Me = { - id: string; - username: string; - first_name?: string | null; - last_name?: string | null; - email?: string | null; - location?: string | null; - avatar?: { id: string; filename_download: string } | null; -}; - -export default function AccountPanel() { - const [me, setMe] = useState(null); - const [err, setErr] = useState(null); - const [loading, setLoading] = useState(true); - - useEffect(() => { - let alive = true; - (async () => { - try { - setErr(null); - const r = await fetch("/api/account", { credentials: "include", cache: "no-store" }); - if (!r.ok) throw new Error(`Load failed (${r.status})`); - const j = await r.json(); - if (alive) setMe(j); - } catch (e: any) { - if (alive) setErr(e?.message || "Failed to load account"); - } finally { - if (alive) setLoading(false); - } - })(); - return () => { alive = false; }; - }, []); - - if (loading) return
Loading…
; - if (err) return
Error: {err}
; - if (!me) return null; - - return ( -
-
-

Account

-
-
Username
{me.username}
-
First Name
{me.first_name || "—"}
-
Last Name
{me.last_name || "—"}
-
Email
{me.email || "—"}
-
Location
{me.location || "—"}
-
-

Usernames can’t be changed.

-
- - {/* Place your edit forms here; they should only call the update APIs on submit, - never during initial render. For password/avatar we can prompt for password - inline or send to /auth/sign-in?reauth=1&next=/portal/account#security. */} -
- ); -}