Feat(Fix): User & Org Setup Initial (Invite + Create on own) & Chore: UI

This commit is contained in:
2026-03-01 20:11:22 +05:45
parent 4c01fd0107
commit f1a8e313fc
10 changed files with 485 additions and 68 deletions
+4 -3
View File
@@ -4,17 +4,18 @@ import { useAuth } from "@/contexts/AuthContext";
const Index = () => {
const navigate = useNavigate();
const { isAuthenticated, isLoading } = useAuth();
const { isAuthenticated, isOrgMember, isLoading } = useAuth();
useEffect(() => {
if (isLoading) return; // Wait for auth check to complete
if (isAuthenticated) {
navigate("/profile");
// If the user has no org yet, send them to the org-setup page first
navigate(isOrgMember ? "/profile" : "/org-setup", { replace: true });
} else {
navigate("/login");
}
}, [isLoading, isAuthenticated, navigate]);
}, [isLoading, isAuthenticated, isOrgMember, navigate]);
return null;
};