Open wangzixi-diablo opened 3 years ago
This issue is for discussion in this StackOverflow question:https://stackoverflow.com/questions/66458798/how-can-i-detect-current-users-user-group-in-spartacus
In order to test it, I add the following source code in AppModule's constructor:
constructor(b2b: B2BUserService){ const result = b2b.getUserGroups('ab3f7a08-690a-4616-b1fe-4f0847fcb79f', { pageSize: 100 }); result.subscribe((data) => console.log('Ethan: ' , data)); }
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?
This issue is for discussion in this StackOverflow question:https://stackoverflow.com/questions/66458798/how-can-i-detect-current-users-user-group-in-spartacus
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:
callstack:
Do I need to call some other method to "initialize" the state before I access it?