import { getMemberToken, getApiBaseUrl } from '../../_lib/api'; import { DeleteAccountButton } from './DeleteAccountButton'; import { MemberLogoutButton } from './MemberLogoutButton'; import { ProfileForm } from './ProfileForm'; import Link from 'next/link'; interface FullProfile { id: string; jid: string; displayName: string | null; avatar: string | null; hometown: string | null; currentLocation: string | null; interests: string[]; language: string; digestPreference: string; directoryVisible: boolean; createdAt: string; } interface GroupSummary { id: string; name: string; joinedAt: string; consentStatus: string; } async function fetchDashboard(token: string) { const res = await fetch(`${getApiBaseUrl()}/my/dashboard`, { headers: { Authorization: `Bearer ${token}` }, cache: 'no-store', }).catch(() => null); if (!res || !res.ok) return null; return res.json() as Promise<{ profile: FullProfile; groups: GroupSummary[] }>; } export default async function SettingsPage() { const token = await getMemberToken(); if (!token) { return (
Complete onboarding to manage your account.
Could not load profile data.
)}You gave consent to receive messages from these groups. You can opt out at any time.
{g.name}
Since {new Date(g.joinedAt).toLocaleDateString()} · {g.consentStatus === 'GRANTED' ? 'Active' : 'Revoked'}
Sign out of your member portal. Your consent records are kept until you delete your account.
This permanently deletes your TOWER user record, all consent records, opt-out history, and sessions. The messages themselves stay in their original groups. This cannot be undone.