79479510

Date: 2025-03-02 18:12:27
Score: 1
Natty:
Report link

In the list of routes in the image, you do not use AuthorisedUserGuard, but AuthGuard (it is not clear what it is). Use AuthorisedUserGuard.

I also want to add:

You don't need to use Promise, you already have an Observable. Guard can use Observable (MaybeAsync) in the output.

Remove async/await, and return a simple Observable. If you need to forward if false, then use tap().

For info: https://angular.dev/api/router/CanActivate https://angular.dev/api/router/MaybeAsync

Reasons:
  • No code block (0.5):
  • Low reputation (0.5):
Posted by: Sergey Barabanov