angular-token icon indicating copy to clipboard operation
angular-token copied to clipboard

`currentUserData` is not updated after `registerAccount()`

Open hossameldeen opened this issue 7 years ago • 2 comments

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

hossameldeen avatar Feb 26 '19 09:02 hossameldeen

Could you give 7.1.0-rc.0 a try? There we've completely rewritten the way currentUserData is updated. Thanks!

neroniaky avatar Mar 03 '19 16:03 neroniaky

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!

hossameldeen avatar Mar 04 '19 08:03 hossameldeen