Skip to content

Commit

Permalink
add status check to headers
Browse files Browse the repository at this point in the history
  • Loading branch information
TaylorFries committed Jul 9, 2024
1 parent 3754643 commit e2f252b
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions react-app/src/components/layout/Header.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import React, { useContext } from 'react';
import headerImageLarge from '@/assets/images/BCGOV_logo.svg';
import headerImageSmall from '@/assets/images/BCID_V_rgb_pos.png';
import {
Expand All @@ -15,6 +15,7 @@ import {
import { Link as RouterLink, useNavigate } from 'react-router-dom';
import { useSSO } from '@bcgov/citz-imb-sso-react';
import { Roles } from '@/constants/roles';
import { AuthContext } from '@/contexts/authContext';

const AppBrand = () => {
const theme = useTheme();
Expand Down Expand Up @@ -60,6 +61,7 @@ const AppBrand = () => {
};

const Header: React.FC = () => {
const auth = useContext(AuthContext);
const { logout, isAuthenticated, login, user } = useSSO();
const theme = useTheme();
const navigate = useNavigate();
Expand All @@ -81,6 +83,7 @@ const Header: React.FC = () => {
const handleClose = () => {
setAnchorEl(null);
};

return (
<AppBar
elevation={0}
Expand All @@ -100,7 +103,7 @@ const Header: React.FC = () => {
<AppBrand />
<Box flexGrow={1}></Box>
<Box textAlign={'center'} alignItems={'center'} gap={'32px'} display={'flex'}>
{isAuthenticated && (
{isAuthenticated && auth.pimsUser.data?.Status === 'Active' && (
<>
{user.client_roles?.includes(Roles.ADMIN) ? (
<>
Expand Down

0 comments on commit e2f252b

Please sign in to comment.