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.
This commit is contained in:
gpt-engineer-app[bot] 2025-06-23 03:38:53 +00:00
parent 749624e7a4
commit 6809553751
3 changed files with 15 additions and 10 deletions

View File

@ -34,19 +34,13 @@ function App() {
{/* Landing page - só mostra se não estiver logado */}
<Route
path="/"
element={isLoggedIn ? (
<ProtectedRoute>
<Suspense fallback={<div className="flex items-center justify-center min-h-screen">Carregando...</div>}>
<Dashboard />
</Suspense>
</ProtectedRoute>
) : <Landing />}
element={isLoggedIn ? <Navigate to="/dashboard" replace /> : <Landing />}
/>
{/* Auth route */}
{/* Auth route - redireciona para dashboard se já estiver logado */}
<Route
path="/auth"
element={isLoggedIn ? <Navigate to="/" replace /> : <Auth />}
element={isLoggedIn ? <Navigate to="/dashboard" replace /> : <Auth />}
/>
{/* Email confirmation route */}

View File

@ -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');
}
};

View File

@ -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 = () => {
<Boxes />
{/* Botão para voltar à landing page */}
<Link to="/" className="absolute top-4 left-4 z-30">
<Button variant="ghost" size="sm" className="text-white hover:bg-white/10">
<ArrowLeft className="h-4 w-4 mr-2" />
Voltar
</Button>
</Link>
<Card className="w-full max-w-md relative z-20 bg-white/95 backdrop-blur-sm border-white/20">
<CardHeader className="space-y-1 text-center">
<div className="flex items-center justify-center space-x-2 mb-4">