Merge pull request #10 from rede5/codex/fix-admin-login-redirect-to-dashboard
Unify dashboard routing for all roles
This commit is contained in:
commit
79a59e44cd
3 changed files with 4 additions and 18 deletions
|
|
@ -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.");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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) => {
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue