In my angular 12 project, I have applied canActivate
on routes but due to which routes are not working on browser page reload.
In canActivate
, i am checking data is present or not in localStorage for currentUser. but when I reload page I didn't get value for localStorage item.
If I remove canActivate
then page reload works fine.
Is there any other way in which I can prevent user for accessing routes if not logged in?