diff --git a/packages/dashboard-frontend/src/Routes/index.tsx b/packages/dashboard-frontend/src/Routes/index.tsx index 68f45dca2..36f029fbc 100644 --- a/packages/dashboard-frontend/src/Routes/index.tsx +++ b/packages/dashboard-frontend/src/Routes/index.tsx @@ -11,9 +11,10 @@ */ import React from 'react'; -import { Redirect, Route, Switch } from 'react-router'; +import { Redirect, Route, RouteComponentProps, Switch } from 'react-router'; import { ROUTE } from '../route.enum'; +import { buildFactoryLoaderPath } from '../preload'; const CreateWorkspace = React.lazy(() => import('../pages/GetStarted')); const WorkspacesListContainer = React.lazy(() => import('../containers/WorkspacesList')); @@ -45,11 +46,23 @@ function Routes(): React.ReactElement { )); return ( + + {...routes} - + ); } +function redirectToFactoryLoader(props: RouteComponentProps): React.ReactElement { + const { pathname, search } = props.location; + let factoryUrl = pathname.substring(1) + search; + if (!factoryUrl.includes('?')) { + factoryUrl = factoryUrl.replace('&', '?'); + } + const factoryLoaderPath = buildFactoryLoaderPath(factoryUrl).replace(/^\/f/, ROUTE.LOAD_FACTORY); + return ; +} + Routes.displayName = 'RoutesComponent'; export default Routes; diff --git a/packages/dashboard-frontend/src/preload/index.ts b/packages/dashboard-frontend/src/preload/index.ts index 801f9ada5..f23d2d8d1 100644 --- a/packages/dashboard-frontend/src/preload/index.ts +++ b/packages/dashboard-frontend/src/preload/index.ts @@ -11,6 +11,9 @@ */ (function acceptNewFactoryLink(): void { + if (window.location.pathname !== '/') { + return; + } const hash = window.location.hash.replace(/(\/?)#(\/?)/, '#'); if (hash.startsWith('#http')) { let factoryUrl = hash.substring(1);