Currently, I am in the process of developing an application using Angular 7. So far, everything is running smoothly as I have successfully managed API calls, JWT Token authentication with C#, and updating LocalStorage when needed during user login and logout.
However, I am facing a dilemma regarding setting up a middleware for login check within the application rather than relying on the lifecycle method - ng.onInit()
. How can I accomplish this?
I am also curious if there is a way to trigger lifecycle events through an entry component or service. This would allow the application to verify the user's login status before loading any components and redirecting appropriately via Router.