Skip to content

Commit

Permalink
feat: show dashboard button only if the user is authenticated and the…
Browse files Browse the repository at this point in the history
… user role is other than `Regulator`
  • Loading branch information
Sujit committed Nov 26, 2024
1 parent e22bc94 commit f766b83
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/frontend/src/components/LandingPage/Home/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@ import arrowSouth from '@Assets/images/LandingPage/arrow_south.svg';
import { setCommonState } from '@Store/actions/common';
import useAuth from '@Hooks/useAuth';
import { useNavigate } from 'react-router-dom';
import { getLocalStorageValue } from '@Utils/getLocalStorageValue';

export default function Home() {
const dispatch = useTypedDispatch();
const { isAuthenticated } = useAuth();
const navigate = useNavigate();
const userProfile = getLocalStorageValue('userprofile');

const bounceTransition: {
y: {
Expand Down Expand Up @@ -52,7 +54,7 @@ export default function Home() {
<div className="naxatw-container naxatw-h-full !naxatw-max-w-full naxatw-py-12">
<div className="naxatw-flex naxatw-animate-fade-up naxatw-flex-row naxatw-justify-between">
<Image src={droneTaskingManagerLogo} />
{isAuthenticated() ? (
{isAuthenticated() && !userProfile?.role?.includes('REGULATOR') ? (
<Button
onClick={() => navigate('/projects')}
className="naxatw-cursor-pointer !naxatw-rounded-[3.125rem] naxatw-border naxatw-px-5 naxatw-py-3 naxatw-text-body-md naxatw-font-normal naxatw-text-landing-white"
Expand Down

0 comments on commit f766b83

Please sign in to comment.