#Guards, Services and Signals

2 messages · Page 1 of 1 (latest)

gritty torrent
#

I have an AuthService that exposes some computed signals for current user etc. which are retrieved from a NgRx SignalStore. In the constructor of the service, I check sessionStorage and populate the store with values from the sessionStorage. I also have an Auth Guard that injects the AuthService and uses the signal for role to determine access. I can see the AuthService constructor gets called and I have an effect to log the current User (which gets populated) however my role signal in the authguard is not getting the updated value.

I guess this won't work, so where is the best place in the app to populate my state store from session storage?

summer forge
#

Post a complete minimal repro. A description of what you're doing isn't sufficient for us to find the problem in your code.
Read #how-to-get-help