Skip to content

Commit

Permalink
Redirect for specific dashboard after login (#229)
Browse files Browse the repository at this point in the history
  • Loading branch information
Disura-Randunu authored Dec 8, 2024
1 parent cdc3413 commit 8814991
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
14 changes: 14 additions & 0 deletions src/components/Layout/Navbar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,20 @@ const Navbar: React.FC = () => {
};
}, []);

useEffect(() => {
if (user) {
if (isUserMentor) {
navigate('/mentor/dashboard');
} else if (isUserAdmin) {
navigate('/admin/dashboard/mentor-applications');
} else if (isUserMentee) {
navigate('/mentee/dashboard');
} else {
navigate('/');
}
}
}, [user]);

return (
<div className="fixed top-0 start-0 flex justify-between w-full z-20">
<nav className="bg-white border-gray-200 container mx-auto">
Expand Down
6 changes: 4 additions & 2 deletions src/pages/MentorProfile/MentorProfile.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,8 @@ const MentorProfile: React.FC = () => {
<span className="w-0.5 h-24 bg-gray-300 md:block hidden"></span>

{mentor?.application.linkedin && (
<a href={mentor.application.linkedin}
<a
href={mentor.application.linkedin}
target="_blank"
rel="noreferrer"
className="text-blue-500 underline"
Expand All @@ -205,7 +206,8 @@ const MentorProfile: React.FC = () => {
)}

{mentor?.application.website && (
<a href={mentor.application.website}
<a
href={mentor.application.website}
target="_blank"
rel="noreferrer"
className="text-blue-500 underline"
Expand Down

0 comments on commit 8814991

Please sign in to comment.