Commit 6cd8cc9e authored by Zhou Fang's avatar Zhou Fang
Browse files

Minor improvements on overall logic

parent d80c9428
......@@ -22,7 +22,6 @@ import {
PERMISSIONS_BASED_ON_ROLES,
UPDATE_DENYLISTED_RELATIONS,
ROLE_DESCRIPTION,
ORIGINAL_PATH_KEY,
} from '../../../Constants/Constants';
import { useContext, useEffect, useState } from 'react';
import PortalContext from '../../../Context/PortalContext';
......@@ -494,10 +493,6 @@ export default function ContactManagement() {
saveContacts(contactData);
}, [contactData, allRelations]);
useEffect(() => {
currentUser !== null && sessionStorage.setItem(ORIGINAL_PATH_KEY, '/portal');
}, [currentUser]);
return !checkPermission(PERMISSIONS_BASED_ON_ROLES.accessContacts, currentUser?.relation) ? (
<NoAccess />
) : (
......
......@@ -6,20 +6,12 @@ import DashboardProjectsAndWG from './DashboardProjectsAndWG/DashboardProjectsAn
import DashboardResources from './DashboardResources';
import { useContext, useEffect, useState } from 'react';
import { fetchWrapper } from '../../../Utils/formFunctionHelpers';
import {
api_prefix,
FETCH_METHOD,
getCurrentMode,
MODE_REACT_ONLY,
ORIGINAL_PATH_KEY,
} from '../../../Constants/Constants';
import { api_prefix, FETCH_METHOD, getCurrentMode, MODE_REACT_ONLY } from '../../../Constants/Constants';
import { OrganizationRoles, OrgInfoBackend, OrgRep } from '../../../Interfaces/portal_interface';
import PortalContext from '../../../Context/PortalContext';
import GlobalContext from '../../../Context/GlobalContext';
export default function Dashboard() {
const { orgId, orgInfo, setOrgInfo } = useContext(PortalContext);
const { currentUser } = useContext(GlobalContext);
const [orgRepData, setOrgRepData] = useState<Array<OrgRep> | null>(null);
useEffect(() => {
......@@ -70,9 +62,6 @@ export default function Dashboard() {
fetchWrapper(urlForOrgInfo, FETCH_METHOD.GET, saveOrgInfo);
}, [orgId, orgInfo, setOrgInfo]);
useEffect(() => {
currentUser !== null && sessionStorage.setItem(ORIGINAL_PATH_KEY, '/portal');
}, [currentUser]);
return (
<>
<DashboardIntro orgRepData={orgRepData} />
......
import { createStyles, makeStyles, Typography, Theme } from '@material-ui/core';
import BusinessIcon from '@material-ui/icons/Business';
import { brightOrange, iconGray, ORIGINAL_PATH_KEY, PERMISSIONS_BASED_ON_ROLES } from '../../../Constants/Constants';
import { brightOrange, iconGray, PERMISSIONS_BASED_ON_ROLES } from '../../../Constants/Constants';
import GlobalContext from '../../../Context/GlobalContext';
import { checkPermission } from '../../../Utils/portalFunctionHelpers';
import OrgProfilesBasicInfo from './OrgProfilesBasicInfo';
import OrgProfilesLinks from './OrgProfilesLinks';
import { useContext, useEffect } from 'react';
import { useContext } from 'react';
import NoAccess from '../../ErrorPages/NoAccess';
const useStyle = makeStyles((theme: Theme) =>
......@@ -25,10 +25,6 @@ export default function OrgProfile() {
const classes = useStyle();
const { currentUser } = useContext(GlobalContext);
useEffect(() => {
currentUser !== null && sessionStorage.setItem(ORIGINAL_PATH_KEY, '/portal');
}, [currentUser]);
return !checkPermission(PERMISSIONS_BASED_ON_ROLES.accessContacts, currentUser?.relation) ? (
<NoAccess />
) : (
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment