Skip to content

Commit 57d1766

Browse files
committed
feat: TT-174 pop-up message for redirect to b2 from legacy
1 parent 3dc8359 commit 57d1766

File tree

1 file changed

+33
-17
lines changed

1 file changed

+33
-17
lines changed

src/app/app-routing.module.ts

Lines changed: 33 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11,25 +11,41 @@ import { HomeComponent } from './modules/home/home.component';
1111
import { LoginComponent } from './modules/login/login.component';
1212
import { CustomerComponent } from './modules/customer-management/pages/customer.component';
1313
import { UsersComponent } from './modules/users/pages/users.component';
14+
import { EnvironmentType } from 'src/environments/enum';
15+
import { environment } from 'src/environments/environment';
1416

15-
const routes: Routes = [
16-
{
17-
path: '',
18-
component: HomeComponent,
19-
canActivate: [LoginGuard],
20-
children: [
21-
{ path: 'reports', canActivate: [AdminGuard], component: ReportsComponent },
22-
{ path: 'time-clock', component: TimeClockComponent },
23-
{ path: 'time-entries', component: TimeEntriesComponent },
24-
{ path: 'activities-management', component: ActivitiesManagementComponent },
25-
{ path: 'customers-management', canActivate: [AdminGuard], component: CustomerComponent },
26-
{ path: 'users', canActivate: [AdminGuard], component: UsersComponent },
27-
{ path: '', pathMatch: 'full', redirectTo: 'time-clock' },
28-
],
29-
},
30-
{ path: 'login', component: LoginComponent },
31-
];
17+
let isLegacyProd: boolean = environment.production === EnvironmentType.TT_PROD_LEGACY;
18+
let routes: Routes;
3219

20+
if (isLegacyProd) {
21+
routes = [
22+
{
23+
path: '',
24+
children: [
25+
{ path: '**', redirectTo: 'redirect-message' },
26+
],
27+
},
28+
]
29+
30+
} else {
31+
routes = [
32+
{
33+
path: '',
34+
component: HomeComponent,
35+
canActivate: [LoginGuard],
36+
children: [
37+
{ path: 'reports', canActivate: [AdminGuard], component: ReportsComponent },
38+
{ path: 'time-clock', component: TimeClockComponent },
39+
{ path: 'time-entries', component: TimeEntriesComponent },
40+
{ path: 'activities-management', component: ActivitiesManagementComponent },
41+
{ path: 'customers-management', canActivate: [AdminGuard], component: CustomerComponent },
42+
{ path: 'users', canActivate: [AdminGuard], component: UsersComponent },
43+
{ path: '', pathMatch: 'full', redirectTo: 'time-clock' },
44+
],
45+
},
46+
{ path: 'login', component: LoginComponent }
47+
];
48+
}
3349
@NgModule({
3450
imports: [RouterModule.forRoot(routes)],
3551
exports: [RouterModule],

0 commit comments

Comments
 (0)