Skip to content

Commit

Permalink
removed unwanted newId variable
Browse files Browse the repository at this point in the history
  • Loading branch information
sethdivyansh committed Oct 30, 2024
1 parent d1dddd0 commit aa46b0d
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/components/LeftDrawerOrg/LeftDrawerOrg.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,8 @@ const leftDrawerOrg = ({
// Index 2 represents the ID in paths like /member/{userId}
return segments.length > 2 ? segments[2] : '';
};

const id = getIdFromPath(location.pathname);
// if param id is equal to userId, then it is a profile page
const [isProfilePage, setIsProfilePage] = useState(id === userId);
const [isProfilePage, setIsProfilePage] = useState(false);
const [showDropdown, setShowDropdown] = useState(false);
const [organization, setOrganization] =
useState<InterfaceQueryOrganizationsListObject>();
Expand All @@ -68,8 +66,9 @@ const leftDrawerOrg = ({

// Check if the current page is admin profile page
useEffect(() => {
const newId = getIdFromPath(location.pathname);
setIsProfilePage(newId === userId);
// id could be userId or orgId
const id = getIdFromPath(location.pathname);
setIsProfilePage(id === userId);
}, [location, userId]);

// Set organization data when query data is available
Expand Down

0 comments on commit aa46b0d

Please sign in to comment.