Skip to content

Commit

Permalink
refactor: skip requests count API call for users who don't have neces…
Browse files Browse the repository at this point in the history
…sary permissions
  • Loading branch information
AkashRajpurohit committed Jan 8, 2025
1 parent 2ea997b commit 37308b0
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/components/Layout/Sidebar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,11 @@ const Sidebar = ({ open, setClosed }: SidebarProps) => {
const intl = useIntl();
const { hasPermission } = useUser();
const { data: requests } = useSWR<RequestCountResponse>(
'/api/v1/request/count'
hasPermission([Permission.MANAGE_REQUESTS, Permission.ADMIN], {
type: 'or',
})
? '/api/v1/request/count'
: null
);
useClickOutside(navRef, () => setClosed());

Expand Down

0 comments on commit 37308b0

Please sign in to comment.