Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding ViewQueue path to Routes is error prone #26

Open
Jan-PeterRichterCG opened this issue Mar 14, 2019 · 0 comments
Open

Adding ViewQueue path to Routes is error prone #26

Jan-PeterRichterCG opened this issue Mar 14, 2019 · 0 comments

Comments

@Jan-PeterRichterCG
Copy link
Member

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:

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant