Add guard redirect to GetStarted and remove onboarding link to /get-started
cgen-e8074c164bfe458f964b63d936087187
This commit is contained in:
parent
8c41b8d0cd
commit
1d1df5bab0
1 changed files with 12 additions and 1 deletions
|
|
@ -2,7 +2,9 @@ import Layout from "@/components/Layout";
|
|||
import { Button } from "@/components/ui/button";
|
||||
import { Card, CardContent, CardHeader, CardTitle, CardDescription } from "@/components/ui/card";
|
||||
import { Badge } from "@/components/ui/badge";
|
||||
import { Link } from "react-router-dom";
|
||||
import { Link, useNavigate } from "react-router-dom";
|
||||
import { useEffect } from "react";
|
||||
import { useAuth } from "@/contexts/AuthContext";
|
||||
import { UserPlus, Settings, LayoutDashboard, BookOpen, Users, LifeBuoy, ArrowRight, CheckCircle } from "lucide-react";
|
||||
|
||||
export default function GetStarted() {
|
||||
|
|
@ -39,6 +41,15 @@ export default function GetStarted() {
|
|||
{ title: "Support", desc: "We’re here to help", icon: LifeBuoy, href: "/support", color: "from-amber-500 to-orange-500" },
|
||||
];
|
||||
|
||||
const navigate = useNavigate();
|
||||
const { user, profileComplete, loading } = useAuth();
|
||||
|
||||
useEffect(() => {
|
||||
if (loading) return;
|
||||
if (user && profileComplete) navigate("/dashboard", { replace: true });
|
||||
if (user && !profileComplete) navigate("/onboarding", { replace: true });
|
||||
}, [user, profileComplete, loading, navigate]);
|
||||
|
||||
return (
|
||||
<Layout>
|
||||
<section className="relative overflow-hidden">
|
||||
|
|
|
|||
Loading…
Reference in a new issue