|
1 | 1 | /* eslint-disable max-len */ |
2 | 2 | import { Navigate } from 'react-router-dom' |
3 | 3 |
|
4 | | -import { ToolTitle } from '~/config' |
5 | | -import { lazyLoad, LazyLoadedComponent, PlatformRoute } from '~/libs/core' |
| 4 | +import { AppSubdomain, EnvironmentConfig, ToolTitle } from '~/config' |
| 5 | +import { lazyLoad, LazyLoadedComponent, PlatformRoute, Rewrite } from '~/libs/core' |
6 | 6 |
|
7 | 7 | import { Work, WorkIntakeFormRoutes, WorkStatus, WorkType } from './lib' |
8 | 8 | import { bugHuntRoute, selfServiceRootRoute, selfServiceStartRoute, workDashboardRoute, workRootRoute } from './config' |
@@ -54,6 +54,15 @@ export function workDetailRoute(workId: string, tab?: 'solutions' | 'messages'): |
54 | 54 | return `${selfServiceRootRoute}/work-items/${workId}${!!tab ? `?tab=${tab}` : ''}` |
55 | 55 | } |
56 | 56 |
|
| 57 | +const oldUrlRedirectRoute: ReadonlyArray<PlatformRoute> = EnvironmentConfig.SUBDOMAIN === AppSubdomain.work ? [ |
| 58 | + { |
| 59 | + children: [], |
| 60 | + element: <Rewrite to='/*' />, |
| 61 | + id: 'redirect-old-url', |
| 62 | + route: '/work/*', |
| 63 | + }, |
| 64 | +] : [] |
| 65 | + |
57 | 66 | export const selfServiceRoutes: ReadonlyArray<PlatformRoute> = [ |
58 | 67 | { |
59 | 68 | element: <NotLoggedIn />, |
@@ -85,6 +94,10 @@ export const selfServiceRoutes: ReadonlyArray<PlatformRoute> = [ |
85 | 94 | }, |
86 | 95 | { |
87 | 96 | children: [ |
| 97 | + { |
| 98 | + element: <Navigate to={selfServiceStartRoute} />, |
| 99 | + route: '/', |
| 100 | + }, |
88 | 101 | // Edit work item |
89 | 102 | { |
90 | 103 | element: <SelfServiceWorkItem />, |
@@ -159,4 +172,5 @@ export const selfServiceRoutes: ReadonlyArray<PlatformRoute> = [ |
159 | 172 | element: <Navigate to={workDashboardRoute} />, |
160 | 173 | route: `${selfServiceRootRoute}/dashboard`, |
161 | 174 | }, |
| 175 | + ...oldUrlRedirectRoute, |
162 | 176 | ] |
0 commit comments