frontend: refactor routing configuration to remove unused routes and components, streamline guards, and enhance clarity
This commit is contained in:
parent
53779278fa
commit
36cae89b37
@ -1,10 +1,8 @@
|
|||||||
import { Routes } from '@angular/router';
|
import { Routes } from '@angular/router';
|
||||||
import { UserRole } from '@lib/typings/ce';
|
|
||||||
import {
|
import {
|
||||||
applicationModeGuard,
|
applicationModeGuard,
|
||||||
checkParticipantNameGuard,
|
checkParticipantNameGuard,
|
||||||
checkParticipantRoleAndAuthGuard,
|
checkParticipantRoleAndAuthGuard,
|
||||||
checkRoomCreatorEnabledGuard,
|
|
||||||
checkUserAuthenticatedGuard,
|
checkUserAuthenticatedGuard,
|
||||||
checkUserNotAuthenticatedGuard,
|
checkUserNotAuthenticatedGuard,
|
||||||
extractRecordingQueryParamsGuard,
|
extractRecordingQueryParamsGuard,
|
||||||
@ -17,15 +15,12 @@ import {
|
|||||||
} from '../guards';
|
} from '../guards';
|
||||||
import {
|
import {
|
||||||
ConsoleComponent,
|
ConsoleComponent,
|
||||||
ConsoleLoginComponent,
|
|
||||||
DisconnectedComponent,
|
DisconnectedComponent,
|
||||||
ErrorComponent,
|
ErrorComponent,
|
||||||
LoginComponent,
|
LoginComponent,
|
||||||
OverviewComponent,
|
OverviewComponent,
|
||||||
ParticipantNameFormComponent,
|
ParticipantNameFormComponent,
|
||||||
RecordingsComponent,
|
RecordingsComponent,
|
||||||
RoomCreatorComponent,
|
|
||||||
RoomCreatorDisabledComponent,
|
|
||||||
RoomFormComponent,
|
RoomFormComponent,
|
||||||
RoomRecordingsComponent,
|
RoomRecordingsComponent,
|
||||||
RoomsComponent,
|
RoomsComponent,
|
||||||
@ -33,41 +28,15 @@ import {
|
|||||||
} from '../pages';
|
} from '../pages';
|
||||||
|
|
||||||
export const baseRoutes: Routes = [
|
export const baseRoutes: Routes = [
|
||||||
{
|
|
||||||
path: '',
|
|
||||||
component: RoomCreatorComponent,
|
|
||||||
canActivate: [runGuardsSerially(checkRoomCreatorEnabledGuard, checkUserAuthenticatedGuard)],
|
|
||||||
data: {
|
|
||||||
checkSkipAuth: true,
|
|
||||||
expectedRoles: [UserRole.USER],
|
|
||||||
redirectToWhenUnauthorized: 'login',
|
|
||||||
redirectToWhenInvalidRole: 'console'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
path: 'login',
|
path: 'login',
|
||||||
component: LoginComponent,
|
component: LoginComponent,
|
||||||
canActivate: [checkUserNotAuthenticatedGuard],
|
canActivate: [checkUserNotAuthenticatedGuard]
|
||||||
data: { redirectTo: '' }
|
|
||||||
},
|
|
||||||
{ path: 'room-creator-disabled', component: RoomCreatorDisabledComponent },
|
|
||||||
{ path: 'disconnected', component: DisconnectedComponent },
|
|
||||||
{ path: 'error', component: ErrorComponent },
|
|
||||||
{
|
|
||||||
path: 'console/login',
|
|
||||||
component: ConsoleLoginComponent,
|
|
||||||
canActivate: [checkUserNotAuthenticatedGuard],
|
|
||||||
data: { redirectTo: 'console' }
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: 'console',
|
path: 'console',
|
||||||
component: ConsoleComponent,
|
component: ConsoleComponent,
|
||||||
canActivate: [checkUserAuthenticatedGuard],
|
canActivate: [checkUserAuthenticatedGuard],
|
||||||
data: {
|
|
||||||
expectedRoles: [UserRole.ADMIN],
|
|
||||||
redirectToWhenUnauthorized: 'console/login',
|
|
||||||
redirectToWhenInvalidRole: ''
|
|
||||||
},
|
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: '',
|
path: '',
|
||||||
@ -141,7 +110,9 @@ export const baseRoutes: Routes = [
|
|||||||
)
|
)
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{ path: 'disconnected', component: DisconnectedComponent },
|
||||||
|
{ path: 'error', component: ErrorComponent },
|
||||||
|
|
||||||
// Redirect all other routes to RoomCreatorComponent
|
// Redirect all other routes to the console
|
||||||
{ path: '**', redirectTo: '' }
|
{ path: '**', redirectTo: 'console' }
|
||||||
];
|
];
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user