Merge pull request #10 from rede5/codex/fix-admin-login-redirect-to-dashboard

Unify dashboard routing for all roles
This commit is contained in:
Tiago Yamamoto 2025-12-22 13:25:56 -03:00 committed by GitHub
commit 79a59e44cd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 4 additions and 18 deletions

View file

@ -69,14 +69,7 @@ export default function LoginPage() {
localStorage.setItem("rememberedEmail", data.email);
}
// Redirect based on role
if (user.role === "admin" || user.roles?.includes("admin")) {
router.push("/dashboard/admin");
} else if (user.role === "company" || user.roles?.includes("company")) {
router.push("/dashboard/empresa");
} else {
router.push("/dashboard/candidato");
}
router.push("/dashboard");
} else {
setError("Usuário ou senha inválidos.");
}

View file

@ -27,11 +27,7 @@ export function DashboardHeader() {
};
const handleProfileClick = () => {
if (user?.role === "admin") {
router.push("/dashboard/admin/profile");
} else {
router.push("/dashboard/candidato/perfil");
}
router.push("/profile");
};
const getInitials = (name: string) => {

View file

@ -49,7 +49,7 @@ export function Navbar() {
<div className="hidden md:flex items-center gap-4">
<LanguageSwitcher />
{user ? (
<Link href={user.role === "admin" ? "/dashboard/admin" : "/dashboard/candidato"}>
<Link href="/dashboard">
<Button variant="ghost" className="gap-2">
<User className="w-4 h-4" />
Dashboard
@ -100,10 +100,7 @@ export function Navbar() {
<div className="flex flex-col gap-2 mt-4 pt-4 border-t">
{user ? (
<Link
href={user.role === "admin" ? "/dashboard/admin" : "/dashboard/candidato"}
onClick={() => setIsOpen(false)}
>
<Link href="/dashboard" onClick={() => setIsOpen(false)}>
<Button variant="ghost" className="w-full justify-start gap-2">
<User className="w-4 h-4" />
Dashboard