11import { AppSubdomain , EnvironmentConfig } from '../../config'
2- import { authUrlLogin , lazyLoad , LazyLoadedComponent , PlatformRoute } from '../../lib'
2+ import { authUrlLogin , lazyLoad , LazyLoadedComponent , PlatformRoute , Rewrite } from '../../lib'
33
44import { toolTitle } from './Learn'
55import { LearnConfig } from './learn-config'
@@ -23,7 +23,7 @@ const MyCertificate: LazyLoadedComponent = lazyLoad(() => import('./course-certi
2323const UserCertificate : LazyLoadedComponent = lazyLoad ( ( ) => import ( './course-certificate' ) , 'UserCertificate' )
2424const FreeCodeCamp : LazyLoadedComponent = lazyLoad ( ( ) => import ( './free-code-camp' ) , 'FreeCodeCamp' )
2525const MyLearning : LazyLoadedComponent = lazyLoad ( ( ) => import ( './my-learning' ) , 'MyLearning' )
26- const LandingLearn : LazyLoadedComponent = lazyLoad ( ( ) => import ( './Learn' ) )
26+ const LearnRootPage : LazyLoadedComponent = lazyLoad ( ( ) => import ( './Learn' ) )
2727const UserTCACertificate : LazyLoadedComponent = lazyLoad ( ( ) => import ( './tca-certificate' ) , 'CertificateView' )
2828
2929const ValidateTCACertificate : LazyLoadedComponent
@@ -131,7 +131,7 @@ export function getTCACertificateUrl(
131131export function getTCACertificationValidationUrl (
132132 completionUuid : string ,
133133) : string {
134- return `${ absoluteRootRoute } /${ completionUuid } `
134+ return `${ absoluteRootRoute } /certificate/ ${ completionUuid } `
135135}
136136
137137export function getTCAUserCertificationUrl (
@@ -151,6 +151,15 @@ export function getAuthenticateAndEnrollRoute(): string {
151151 return `${ authUrlLogin ( ) } ${ encodeURIComponent ( LEARN_PATHS . tcaEnroll ) } `
152152}
153153
154+ const oldUrlRedirectRoute : ReadonlyArray < PlatformRoute > = EnvironmentConfig . SUBDOMAIN === AppSubdomain . tca ? [
155+ {
156+ children : [ ] ,
157+ element : < Rewrite to = '/*' /> ,
158+ id : 'redirect-old-url' ,
159+ route : '/learn/*' ,
160+ } ,
161+ ] : [ ]
162+
154163export const learnRoutes : ReadonlyArray < PlatformRoute > = [
155164 {
156165 children : [
@@ -225,7 +234,7 @@ export const learnRoutes: ReadonlyArray<PlatformRoute> = [
225234 children : [ ] ,
226235 element : < ValidateTCACertificate /> ,
227236 id : 'Hiring manager view - uuid param' ,
228- route : ':completionUuid' ,
237+ route : 'certificate/ :completionUuid' ,
229238 } ,
230239 {
231240 children : [ ] ,
@@ -239,9 +248,10 @@ export const learnRoutes: ReadonlyArray<PlatformRoute> = [
239248 id : 'Giring manager preview' ,
240249 route : 'tca-certifications/:certification/preview' ,
241250 } ,
251+ ...oldUrlRedirectRoute ,
242252 ] ,
243253 domain : AppSubdomain . tca ,
244- element : < LandingLearn /> ,
254+ element : < LearnRootPage /> ,
245255 id : toolTitle ,
246256 route : rootRoute ,
247257 } ,
0 commit comments