From 40a48d00a7fa20677cb4dfcb89d375861a65917f Mon Sep 17 00:00:00 2001 From: Muhsin Shah Date: Sat, 24 Feb 2024 17:21:21 +0530 Subject: [PATCH] removed navigate function from components and moved to route wrapper --- frontend/src/App/App.jsx | 6 +++--- frontend/src/MarketplacePage/index.jsx | 7 ------- frontend/src/OrganizationSettingsPage/index.jsx | 4 ---- 3 files changed, 3 insertions(+), 14 deletions(-) diff --git a/frontend/src/App/App.jsx b/frontend/src/App/App.jsx index 90264525a5..7bd725c300 100644 --- a/frontend/src/App/App.jsx +++ b/frontend/src/App/App.jsx @@ -254,9 +254,9 @@ class AppComponent extends React.Component { exact path="/:workspaceId/workspace-settings" element={ - + - + } /> + } diff --git a/frontend/src/MarketplacePage/index.jsx b/frontend/src/MarketplacePage/index.jsx index 98331a2629..b48484fcb6 100644 --- a/frontend/src/MarketplacePage/index.jsx +++ b/frontend/src/MarketplacePage/index.jsx @@ -4,7 +4,6 @@ import { InstalledPlugins } from './InstalledPlugins'; import { MarketplacePlugins } from './MarketplacePlugins'; import { marketplaceService, pluginsService, authenticationService } from '@/_services'; import { toast } from 'react-hot-toast'; -import { useNavigate } from 'react-router-dom'; import config from 'config'; import { BreadCrumbContext } from '@/App/App'; import FolderList from '@/_ui/FolderList/FolderList'; @@ -19,14 +18,8 @@ const MarketplacePage = ({ darkMode, switchDarkMode }) => { const { admin } = authenticationService.currentSessionValue; const ENABLE_MARKETPLACE_DEV_MODE = config.ENABLE_MARKETPLACE_DEV_MODE == 'true'; - const navigate = useNavigate(); - React.useEffect(() => { updateSidebarNAV(''); - - if (!admin) { - navigate('/'); - } // eslint-disable-next-line react-hooks/exhaustive-deps }, [admin]); diff --git a/frontend/src/OrganizationSettingsPage/index.jsx b/frontend/src/OrganizationSettingsPage/index.jsx index 3eaa016b27..bd630ce68b 100644 --- a/frontend/src/OrganizationSettingsPage/index.jsx +++ b/frontend/src/OrganizationSettingsPage/index.jsx @@ -35,10 +35,6 @@ export function OrganizationSettings(props) { } }; - if (!admin) { - navigate('/'); - } - useEffect(() => { const subscription = authenticationService.currentSession.subscribe((newOrd) => { setAdmin(newOrd?.admin);