From 0777188c1a03cd8612161ac3813f94d5e028dafa Mon Sep 17 00:00:00 2001 From: "Builder.io" Date: Sat, 18 Oct 2025 21:40:21 +0000 Subject: [PATCH] Make Realms page auth-aware actions cgen-c5fe0daa914041348af9840fdd302532 --- client/pages/Realms.tsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/client/pages/Realms.tsx b/client/pages/Realms.tsx index ff649a10..d96323ec 100644 --- a/client/pages/Realms.tsx +++ b/client/pages/Realms.tsx @@ -9,7 +9,7 @@ import { useNavigate } from "react-router-dom"; import { cn } from "@/lib/utils"; export default function Realms() { - const { profile, roles, updateProfile } = useAuth(); + const { user, profile, roles, updateProfile } = useAuth(); const navigate = useNavigate(); const [activating, setActivating] = useState(null); const [selectedRealm, setSelectedRealm] = useState((profile as any)?.user_type ?? null); @@ -44,9 +44,14 @@ export default function Realms() { hasChanges={selectedRealm !== ((profile as any)?.user_type ?? null) || experience !== ((profile as any)?.experience_level || "beginner")} onSave={async () => { if (!selectedRealm) return; + if (!user) { + navigate("/onboarding"); + return; + } setSaving(true); try { await updateProfile({ user_type: selectedRealm, experience_level: experience } as any); + navigate("/dashboard", { replace: true }); } finally { setSaving(false); } @@ -56,7 +61,7 @@ export default function Realms() {
- +