You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After that, we are going to include the component in the app-routing.module.ts adding also the guard, only allowing users that are VISITOR to see the component.
....
const appRoutes: Routes = [
....
{ path: 'ViewQueue', component: ViewQueueComponent,
canActivate: [AuthGuardService]}, // Redirect if url path is /ViewQueue, check if canActivate() with the AuthGuardService.
....
];
....
Problem: If you add the line at the end of the array then the added path has no effect - the '**' default path is evaluated before the newly added path at the end and always wins.
This leads to a situation where you cannot reach the ViewQueueComponent. For an unexperienced developer it is hard to identify the reason for this. He/she (like me) may think the reason is a malfunction in the AuthGuardService that - for some reason - doesn't return true...
So, it would be helpful to explicitly show where the additional path shall be inserted:
const appRoutes: Routes = [
{ path: 'FormLogin', component: FormLoginComponent}, // Redirect if url path is /access.
{ path: 'Register', component: RegisterComponent}, // Redirect if url path is /Register.
{ path: 'ViewQueue', component: ViewQueueComponent,
canActivate: [AuthGuardService]}, // Redirect if url path is /ViewQueue, check if canActivate() with the AuthGuardService.
{ path: '**', redirectTo: '/FormLogin', pathMatch: 'full' }, // Redirect if url path do not match with any other route.
];
Your environment - windows/Linux, Devonfw version , component
irrelevant
The text was updated successfully, but these errors were encountered:
Category: enhancement
Severity: High
Description of issue / expected enhacement /Comments
The instruction how to add the ViewQueue path to Routes in https://github.com/devonfw/devonfw-tutorial-sources/wiki/build-devon4ng-application#generating-viewqueue is error prone:
Problem: If you add the line at the end of the array then the added path has no effect - the '**' default path is evaluated before the newly added path at the end and always wins.
This leads to a situation where you cannot reach the ViewQueueComponent. For an unexperienced developer it is hard to identify the reason for this. He/she (like me) may think the reason is a malfunction in the AuthGuardService that - for some reason - doesn't return true...
So, it would be helpful to explicitly show where the additional path shall be inserted:
Your environment - windows/Linux, Devonfw version , component
irrelevant
The text was updated successfully, but these errors were encountered: