`currentUserData` is not updated after `registerAccount()`
I'm submitting a...
- [ ] Regression (a behavior that used to work and stopped working in a new release)
- [x] Bug report
- [ ] Performance issue
- [ ] Feature request
- [ ] Documentation issue or request
- [ ] Other... Please describe:
Current behavior
After a successful registerAccount() happens, currentUserData remains undefined.
Expected behavior
For currentUserData to have the same values it'd have after calling signIn().
I quickly checked the network & it seems like user data is indeed returned from the server on registerAccount() request.
What is the motivation / use case for changing the behavior?
Components other than the registration don't have access to user data. So, it'd be useful for them to have access for it without the registration component making an extra signIn() request.
Environment
Angular-Token version: 7.0.1 Angular version: 7.2.5
Bundler
- [x] Angular CLI (Webpack)
- [ ] Webpack
- [ ] SystemJS
Browser:
- [x] Chrome (desktop) version 69
- [ ] Chrome (Android) version XX
- [ ] Chrome (iOS) version XX
- [ ] Firefox version XX
- [ ] Safari (desktop) version XX
- [ ] Safari (iOS) version XX
- [ ] IE version XX
- [ ] Edge version XX
Could you give 7.1.0-rc.0 a try? There we've completely rewritten the way currentUserData is updated. Thanks!
Great to hear! Thank you for your work!
Tried it out but still the same problem. The smallest reproduction would probably be something like that:
this.tokenService.registerAccount({
login: "[email protected]",
password: "123456",
passwordConfirmation: "123456"
}).subscribe(() => console.log(this.tokenService.currentAuthData, this.tokenService.currentUserData));
You'll find that currentAuthData is logged properly but currentUserData is null.
If you have time to try it out, does the issue reproduce at your side? Thanks!