Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
feat: TT-174 pop-up message for redirect to b2 from legacy
  • Loading branch information
andresacg30 committed Sep 28, 2022
commit 57d17661c92e92d18df02ba69d12dbd1ae18c709
50 changes: 33 additions & 17 deletions src/app/app-routing.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,41 @@ import { HomeComponent } from './modules/home/home.component';
import { LoginComponent } from './modules/login/login.component';
import { CustomerComponent } from './modules/customer-management/pages/customer.component';
import { UsersComponent } from './modules/users/pages/users.component';
import { EnvironmentType } from 'src/environments/enum';
import { environment } from 'src/environments/environment';

const routes: Routes = [
{
path: '',
component: HomeComponent,
canActivate: [LoginGuard],
children: [
{ path: 'reports', canActivate: [AdminGuard], component: ReportsComponent },
{ path: 'time-clock', component: TimeClockComponent },
{ path: 'time-entries', component: TimeEntriesComponent },
{ path: 'activities-management', component: ActivitiesManagementComponent },
{ path: 'customers-management', canActivate: [AdminGuard], component: CustomerComponent },
{ path: 'users', canActivate: [AdminGuard], component: UsersComponent },
{ path: '', pathMatch: 'full', redirectTo: 'time-clock' },
],
},
{ path: 'login', component: LoginComponent },
];
let isLegacyProd: boolean = environment.production === EnvironmentType.TT_PROD_LEGACY;
let routes: Routes;

if (isLegacyProd) {
routes = [
{
path: '',
children: [
{ path: '**', redirectTo: 'redirect-message' },
],
},
]

} else {
routes = [
{
path: '',
component: HomeComponent,
canActivate: [LoginGuard],
children: [
{ path: 'reports', canActivate: [AdminGuard], component: ReportsComponent },
{ path: 'time-clock', component: TimeClockComponent },
{ path: 'time-entries', component: TimeEntriesComponent },
{ path: 'activities-management', component: ActivitiesManagementComponent },
{ path: 'customers-management', canActivate: [AdminGuard], component: CustomerComponent },
{ path: 'users', canActivate: [AdminGuard], component: UsersComponent },
{ path: '', pathMatch: 'full', redirectTo: 'time-clock' },
],
},
{ path: 'login', component: LoginComponent }
];
}
@NgModule({
imports: [RouterModule.forRoot(routes)],
exports: [RouterModule],
Expand Down