From 146d47a6a72f0f44f8bf969bea4fd4a30ecd196f Mon Sep 17 00:00:00 2001 From: Yashwin Date: Tue, 3 Feb 2026 19:48:13 +0530 Subject: [PATCH] Remove ModuleLaunchRedirect component and its associated route from tenant admin routes. Update Modules component to directly open launch URLs in a new tab, streamlining the redirection process. --- src/pages/ModuleLaunchRedirect.tsx | 36 ------------------------------ src/pages/tenant/Modules.tsx | 6 +---- src/routes/tenant-admin-routes.tsx | 5 ----- 3 files changed, 1 insertion(+), 46 deletions(-) delete mode 100644 src/pages/ModuleLaunchRedirect.tsx diff --git a/src/pages/ModuleLaunchRedirect.tsx b/src/pages/ModuleLaunchRedirect.tsx deleted file mode 100644 index 8f87e7d..0000000 --- a/src/pages/ModuleLaunchRedirect.tsx +++ /dev/null @@ -1,36 +0,0 @@ -import { useEffect } from 'react'; -import type { ReactElement } from 'react'; -import { useSearchParams } from 'react-router-dom'; - -const ModuleLaunchRedirect = (): ReactElement => { - const [searchParams] = useSearchParams(); - const launchUrl = searchParams.get('url'); - - useEffect(() => { - if (launchUrl) { - // Make a fetch request with custom headers - fetch(launchUrl, { - method: 'GET', - headers: { - 'bypass-tunnel-reminder': 'true', - }, - credentials: 'include', - }) - .catch(() => { - // Ignore fetch errors, we'll still open the URL - }) - .finally(() => { - // Open the external URL in a new tab - window.open(launchUrl, '_blank', 'noopener,noreferrer'); - }); - } - }, [launchUrl]); - - return ( -
-
Redirecting...
-
- ); -}; - -export default ModuleLaunchRedirect; diff --git a/src/pages/tenant/Modules.tsx b/src/pages/tenant/Modules.tsx index 8c68a98..90c0fd4 100644 --- a/src/pages/tenant/Modules.tsx +++ b/src/pages/tenant/Modules.tsx @@ -1,6 +1,5 @@ import { useState, useEffect } from 'react'; import type { ReactElement } from 'react'; -import { useNavigate } from 'react-router-dom'; import { Layout } from '@/components/layout/Layout'; import { StatusBadge, @@ -28,7 +27,6 @@ const getStatusVariant = (status: string | null): 'success' | 'failure' | 'proce }; const Modules = (): ReactElement => { - const navigate = useNavigate(); const { roles, tenantId } = useAppSelector((state) => state.auth); // const tenantId = useAppSelector((state) => state.auth.tenantId); const [modules, setModules] = useState([]); @@ -82,9 +80,7 @@ const Modules = (): ReactElement => { const launchTenantId = isSuperAdmin ? tenantId : null; const response = await moduleService.launch(moduleId, launchTenantId); if (response.success && response.data.launch_url) { - // Navigate to redirect page with launch URL as query param - const encodedUrl = encodeURIComponent(response.data.launch_url); - navigate(`/tenant/module-launch?url=${encodedUrl}`); + window.open(response.data.launch_url, '_blank', 'noopener,noreferrer'); } } catch (err: any) { setError(err?.response?.data?.error?.message || 'Failed to launch module'); diff --git a/src/routes/tenant-admin-routes.tsx b/src/routes/tenant-admin-routes.tsx index a217a3e..edcec6c 100644 --- a/src/routes/tenant-admin-routes.tsx +++ b/src/routes/tenant-admin-routes.tsx @@ -8,7 +8,6 @@ const Settings = lazy(() => import('@/pages/tenant/Settings')); const Users = lazy(() => import('@/pages/tenant/Users')); const AuditLogs = lazy(() => import('@/pages/tenant/AuditLogs')); const Modules = lazy(() => import('@/pages/tenant/Modules')); -const ModuleLaunchRedirect = lazy(() => import('@/pages/ModuleLaunchRedirect')); // Loading fallback component const RouteLoader = (): ReactElement => ( @@ -55,8 +54,4 @@ export const tenantAdminRoutes: RouteConfig[] = [ path: '/tenant/settings', element: , }, - { - path: '/tenant/module-launch', - element: , - }, ];