Skip to content

Commit

Permalink
Corrected lint issues: Unused Varibales
Browse files Browse the repository at this point in the history
  • Loading branch information
chrtorres committed Mar 19, 2024
1 parent d23c659 commit 34d60bb
Showing 1 changed file with 2 additions and 38 deletions.
40 changes: 2 additions & 38 deletions frontend/src/components/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,15 @@ import {
Drawer,
ListItem,
List,
useMediaQuery,
useTheme
} from '@mui/material';
import {
Menu as MenuIcon,
AccountCircle as UserIcon,
ArrowDropDown
} from '@mui/icons-material';
import { Menu as MenuIcon } from '@mui/icons-material';
import { NavItem } from './NavItem';
import { useRouteMatch } from 'react-router-dom';
import { useAuthContext } from 'context';
import logo from '../assets/crossfeed.svg';
import { withSearch } from '@elastic/react-search-ui';
import { ContextType } from 'context/SearchProvider';
import { SearchBar } from 'components';
import { Autocomplete } from '@mui/material';
import { Organization, OrganizationTag } from 'types';

Check warning on line 20 in frontend/src/components/Header.tsx

View workflow job for this annotation

GitHub Actions / lint

'Organization' is defined but never used

Check warning on line 20 in frontend/src/components/Header.tsx

View workflow job for this annotation

GitHub Actions / lint

'OrganizationTag' is defined but never used

const PREFIX = 'Header';
Expand Down Expand Up @@ -101,7 +94,7 @@ const Root = styled('div')(({ theme }) => ({

[`.${classes.mobileNav}`]: {
padding: `${theme.spacing(2)} ${theme.spacing()}px`
},
}
}));

const GLOBAL_ADMIN = 2;
Expand All @@ -123,20 +116,11 @@ const HeaderNoCtx: React.FC<ContextType> = (props) => {
const history = useHistory();
const location = useLocation();
const {

Check failure on line 118 in frontend/src/components/Header.tsx

View workflow job for this annotation

GitHub Actions / lint

Replace `⏎····user,⏎····logout,⏎····apiGet⏎·` with `·user,·logout,·apiGet`
currentOrganization,
setOrganization,
showAllOrganizations,
setShowAllOrganizations,
setShowMaps,
user,
logout,
apiGet

Check warning on line 121 in frontend/src/components/Header.tsx

View workflow job for this annotation

GitHub Actions / lint

'apiGet' is assigned a value but never used
} = useAuthContext();
const [navOpen, setNavOpen] = useState(false);
const [organizations, setOrganizations] = useState<
(Organization | OrganizationTag)[]
>([]);
const [tags, setTags] = useState<OrganizationTag[]>([]);
const theme = useTheme();

Check warning on line 124 in frontend/src/components/Header.tsx

View workflow job for this annotation

GitHub Actions / lint

'theme' is assigned a value but never used

let userLevel = 0;
Expand All @@ -148,26 +132,6 @@ const HeaderNoCtx: React.FC<ContextType> = (props) => {
}
}

const fetchOrganizations = useCallback(async () => {
try {
const rows = await apiGet<Organization[]>('/v2/organizations/');
let tags: (OrganizationTag | Organization)[] = [];
if (userLevel === GLOBAL_ADMIN) {
tags = await apiGet<OrganizationTag[]>('/organizations/tags');
await setTags(tags as OrganizationTag[]);
}
await setOrganizations(tags.concat(rows));
} catch (e) {
console.log(e);
}
}, [apiGet, setOrganizations, userLevel]);

React.useEffect(() => {
if (userLevel > 0) {
fetchOrganizations();
}
}, [fetchOrganizations, userLevel]);

const navItems: NavItemType[] = [
{
title: 'Overview',
Expand Down

0 comments on commit 34d60bb

Please sign in to comment.