This issue is for discussion in this StackOverflow question:
https://stackoverflow.com/questions/66458798/how-can-i-detect-current-users-user-group-in-spartacus![](https://img.laitimes.com/img/__Qf2AjLwojIjJCLyojI0JCLicmbw5SMzAjYmlzMmhjN5EjYwYWOyEmM0EDZ4ATZ1M2N0AjMi9CX5d2bs92Yl1iclB3bsVmdlR2LcNWaw9CXt92Yu4GZjlGbh5yYjV3Lc9CX6MHc0RHaiojIsJye.png)
In order to test it, I add the following source code in AppModule’s constructor:
I expect the user group data is printed.
Unfortunately I meet with this error message:
ERROR TypeError: Cannot read property ‘b2bUser’ of undefined
callstack:
Do I need to call some other method to “initialize” the state before I access it?