From 6809553751c7c7542eda58b74981dc885a2bb82d Mon Sep 17 00:00:00 2001 From: "gpt-engineer-app[bot]" <159125892+gpt-engineer-app[bot]@users.noreply.github.com> Date: Mon, 23 Jun 2025 03:38:53 +0000 Subject: [PATCH] Fix: Redirect to dashboard after login Adjusted the login flow to redirect users to the dashboard upon successful authentication, instead of the landing page. This ensures users are directed to the application's core functionality after logging in. --- src/App.tsx | 12 +++--------- src/components/auth/LoginForm.tsx | 3 ++- src/pages/Auth.tsx | 10 ++++++++++ 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index fc0ab76..98a591b 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -34,19 +34,13 @@ function App() { {/* Landing page - só mostra se não estiver logado */} - Carregando...}> - - - - ) : } + element={isLoggedIn ? : } /> - {/* Auth route */} + {/* Auth route - redireciona para dashboard se já estiver logado */} : } + element={isLoggedIn ? : } /> {/* Email confirmation route */} diff --git a/src/components/auth/LoginForm.tsx b/src/components/auth/LoginForm.tsx index 27fee19..a2b671c 100644 --- a/src/components/auth/LoginForm.tsx +++ b/src/components/auth/LoginForm.tsx @@ -36,7 +36,8 @@ const LoginForm = ({ isLoading, setIsLoading }: LoginFormProps) => { toast.success("Login realizado com sucesso", { description: "Bem-vindo de volta!" }); - navigate('/'); + // Redirecionar para o dashboard após login bem-sucedido + navigate('/dashboard'); } }; diff --git a/src/pages/Auth.tsx b/src/pages/Auth.tsx index 3fa7593..63876fe 100644 --- a/src/pages/Auth.tsx +++ b/src/pages/Auth.tsx @@ -4,6 +4,8 @@ import { Link, useLocation } from 'react-router-dom'; import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from "@/components/ui/card"; import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"; import { Boxes } from "@/components/ui/background-boxes"; +import { Button } from "@/components/ui/button"; +import { ArrowLeft } from "lucide-react"; import { cn } from "@/lib/utils"; import LoginForm from '@/components/auth/LoginForm'; import RegisterForm from '@/components/auth/RegisterForm'; @@ -36,6 +38,14 @@ const Auth = () => { + {/* Botão para voltar à landing page */} + + + +